知道美河 | 上传资料 | VIP申请 | 精品课程 | 资料搜索 | 问题反馈 | 会员手册 | 积分消费 | 积分充值 | 帐号保护
美河学习学习在线赞助VIP

美河学习在线(主站) eimhe.com

 找回密码
 建立账号
查看: 7325|回复: 1

[原创] JS代码????

[复制链接]
发表于 2007-4-17 20:01:37 | 显示全部楼层 |阅读模式
function checkIP()
{
var ipArray,ip,j;
ip = document.ipform.ip.value;

if(/[A-Za-z_-]/.test(ip)){
  if(!/^([\w-]+\.)+((com)|(net)|(org)|(gov\.cn)|(info)|(cc)|(com\.cn)|(net\.cn)|(org\.cn)|(name)|(biz)|(tv)|(cn))$/.test(ip)){
   alert("不是正确的域名");
   document.ipform.ip.focus();
   return false;
  }
}
else{
  ipArray = ip.split(".");
  j = ipArray.length
  if(j!=4)
  {
   alert("不是正确的IP");
   document.ipform.ip.focus();
   return false;
  }
  for(var i=0;i<4;i++)
  {
   if(ipArray.length==0 || ipArray>255)
   {
    alert("不是正确的IP");
    document.ipform.ip.focus();
    return false;
   }
  }
}
}
function checkMobile(){
var sMobile = document.mobileform.mobile.value
if(!(/^1[3|5][0-9]\d{4,8}$/.test(sMobile))){
  alert("不是完整的11位手机号或者正确的手机号前七位");
  document.mobileform.mobile.focus();
  return false;
}
window.open('', 'mobilewindow', 'height=197,width=350,status=yes,toolbar=no,menubar=no,location=no')
}
function checkZip(){
var sZip = document.zipform.zip.value
if(!(/^\d{4,6}$/.test(sZip))){
  alert("请输入邮政编码前4-6位");
  return false;
}
window.open('','searchwindow','height=197,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes')
}
function checkZone(){
var sZone = document.zoneform.zone.value
if(!(/^0\d{2,3}$/.test(sZone))){
  alert("请输入以“0”开头的3位或者4位区号");
  return false;
}
window.open('','searchwindow','height=197,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes')
}
function checkArea2Zip(){
var sArea = document.area2zipForm.area.value
if(sArea==""){
  alert("请输入地址");
  document.area2zipForm.area.focus();
  return false;
}
if(sArea.length<2){
  alert("地址至少要有2个字");
  document.area2zipForm.area.focus();
  return false;
}
window.open('','searchwindow','height=197,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes')
}
function checkArea2Zone(){
var sArea = document.area2zoneForm.area.value
if(sArea==""){
  alert("请输入地址");
  document.area2zoneForm.area.focus();
  return false;
}
if(sArea.length<2){
  alert("地址至少要有2个字");
  document.area2zoneForm.area.focus();
  return false;
}
window.open('','searchwindow','height=197,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes')
}
function checkID(){
var sID = document.IDform.userid.value
if(!(/^\d{15}$|^\d{18}$|^\d{17}x$/.test(sID))){
  alert("请输入15位或18位身份证号");
  document.IDform.userid.focus();
  return false;
}
}
发表于 2007-4-18 08:01:07 | 显示全部楼层
您需要登录后才可以回帖 登录 | 建立账号

本版积分规则

 
QQ在线咨询

QQ|小黑屋|手机版|Archiver|美河学习在线 ( 浙网备33020302000026号 )

GMT+8, 2025-5-7 16:28

Powered by Discuz!

© 2001-2025 eimhe.com.

快速回复 返回顶部 返回列表