hwswl

 

页面验证时间格式

本验证方法可以直接拿来使用,不须任何修改。
验证的时间格式为“hh:mm:ss”如“12:01:01”
参数name为控件名称
<script language="javaScript">
function timeCheck(name){
   var strValue=document.getElementsByName(name);
   for(i=0;i<strValue.length;i++){
      var a=strValue[i].value.match(/^(\d{1,2})(:)?(\d{1,2})\2
      (\d{1,2})$/);
      if(a==null){
         alert("输入的参数不是时间格式");
         strValue[i].style.backguandColor="yellow";
         strValue[i].focus();
         return false;
      }
      if(a[1]>24||a[3]>60||a[4>60]){
         alert("输入的参数不是时间格式");
         strValue[i].style.backguandColor="yellow";
         strValue[i].focus();
         return false;
      }
      strValue[i].style.backguandColor="white";
   }
   return true
}
</script>

posted on 2006-07-24 15:44 hwswl 阅读(409) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

留言簿

我参与的团队

文章档案

搜索

最新评论