首页 > Web开发 > 详细

IP,端口,url

时间:2017-03-22 11:48:13      阅读:262      评论:0      收藏:0      [点我收藏+]
//判断输入ip
$("#agencyIp").blur(function(){
   var ip = document.getElementById(‘agencyIp‘).value;
   var re=/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;//正则表达式
   
if(re.test(ip)){
       if( RegExp.$1 < 256 && RegExp.$2 < 256 && RegExp.$3 < 256 && RegExp.$4 < 256){
           $("#agencyIp")[0].className="text easyui-validatebox";
       }else {
           $("#agencyIp").addClass("wrongtext");
       }
   }else {
       $("#agencyIp").addClass("wrongtext");
   }
});

//判断输入端口
$("#agencyPort").blur(function(){
   var str = document.getElementById(‘agencyPort‘).value;
   var parten=/^(\d)+$/g;
   if(parten.test(str)&&parseInt(str)<=65535&&parseInt(str)>0&&parseInt(str)!=""){
       $("#agencyPort")[0].className="text easyui-validatebox";
   }else{
       $("#agencyPort ").addClass("wrongtext");
   }
})


IP,端口,url

原文:http://wyshnc.blog.51cto.com/10221879/1909075

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!