/**
* jQuery mobiletype
*
* @param MobileNumber
* ReturnLanguage(zh or en)
* @returns mobiletype
*
* Example Code <code>
* $.mobiletype("13810095555", "zh");
* </code> Result <code>
* "移动"
* </code>
*
* @author StyleAnt [ styleant.tian@gmail.com ]
*
* version 1.0
*/
(function($) {
var mobiledata = [
{
type : 'ChinaMobile',
title : [ 134, 135, 136, 137, 138, 139, 150, 151, 152, 157,
158, 159, 187, 188, 184 ],
name : '移动'
}, {
type : 'ChinaUnicom',
title : [ 130, 131, 132, 155, 156, 185, 186 ],
name : '联通'
}, {
type : 'ChinaTelecom',
title : [ 133, 153, 180, 189 ],
name : '电信'
} ];
var search = function(k, k1) {
var json = eval(mobiledata);
for ( var i = 0; i < json.length; i++) {
var mobile_title = json[i].title;
for ( var j = 0; j < mobile_title.length; j++) {
if (mobile_title[j] == parseInt(k)) {
if (k1 == 'zh') {
return json[i].name;
} else {
return json[i].type;
}
}
}
}
};
$.extend({
mobiletype : function(string, string) {
if (string.match('^[0-9]*[1-9][0-9]*$') && string.length > 3) {
var k = string.substring(0, 3);
return search(k, string);
} else {
return "Unknow";
}
}
});
})(jQuery);
调用方法:$.mobiletype("13810095555", "zh");
PS:第一次写jquery插件,写得不好,望高手手下留情,呵呵,谢谢!
分享到:
相关推荐
利用jQuery判断 注册填写的 用户名是否重复,电话号码,身份证,邮箱......
基于Jquery的手机触摸屏事件插件,可以辨别手机触摸滑动事件的方向等。响应式开发,移动web端开发很有用。demo众多,简单易用
JQuery mobile 手机模拟器 点击安装就可以直接运行
jQuery制作手机底部菜单 jQuery制作手机底部菜单 jQuery制作手机底部菜单
jquery 判断 IE6 浏览器
Jquery判断radio是否有选中,获取选中的值, 测试有效。兼容各浏览器。非常好用。
jquery判断浏览器版本过低代码是一款对不支持HTML5跟CSS3代码的浏览器提示用户更换特效代码。
jQuery手机下拉框select jQuery手机下拉框select jQuery手机下拉框select
jquery输入格式判断:为空、日期格式、整数、数字格式判断
NULL 博文链接:https://shihuan830619.iteye.com/blog/1974787
jquery支持手机触屏的图片轮播效果jquery支持手机触屏的图片轮播效果
JS判断手机端与电脑访问JS判断手机端与电脑访问
jQuery类似手机QQ界面,有好友列表页面和聊天界面,聊天界面包含表情包,包含图片发送
jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码jQuery源码...
Jquery仿手机滑屏效果 触屏 电脑相当实用。
jQuery手机幻灯片切换放大 jQuery手机幻灯片切换放大 jQuery手机幻灯片切换放大
由于jquery1.9移除了$.browser,所以浏览器类型的判断不再是那么容易,现看到一较好的插件,跟大家分享一下,用于jquery1.9判断浏览器的类型和版本
代码简介:jQuery手机端刮奖效果代码是一款采用jquery.eraser.js插件写的手机端刮奖特效。
jquery+html手机全屏代码,共享给大家
jQuery手机端弹出层提示对话框