标题:javascript关于onblur和validata
只看楼主
why1254
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-8-13
结帖率:0
已结贴  问题点数:5 回复次数:2 
javascript关于onblur和validata
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>onblur</title>

<script language="javascript">
    function check(){
        var _email = validata('email');
        var _address = validate('address');
        alert("*************" + _email);
    }
</script>
</head>
    <body>
        <form id="form1" name="form1" method="post" action="" onsubmit="check();">
              <label>e--mail
              <input type="text" name="email"  onblur="return validata('email')" />
              </label>
               
              <label>address
              <input type="text" name="address"  onblur="return validata('address')" />
              </label>
               
              <label>
              <input type="submit" name="button" value="提交"/>
              </label>
                  
        </form>
    </body>
</html>
为什么点击“提交”时不执行onsubmit
最好在火狐下兼容
搜索更多相关主题的帖子: onblur validata javascript 
2010-09-17 12:03
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
得分:2 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>onblur</title>

<script language="javascript">
    function check(){
        //var _email = validata('email');
        //var _address = validate('address');
        var a=3,b=4;//a和b都为3时能导向aa.asp页面,如果不等就自动返回本页面!验证原理也基于此.这里不知道你的那个validate到底是个什么函数,返回的又是什么??
       if(a==b)
       {return true;}
       else
       {return false;}
    }
</script>
</head>
    <body>
        <form id="form1" name="form1" method="post" action="aa.asp" onsubmit="return check();">
              <label>e--mail
              <input type="text" name="email"  onblur="return validata('email')" />
              </label>
               
              <label>address
              <input type="text" name="address"  onblur="return validata('address')" />
              </label>
               
              <label>
              <input type="submit" name="button" value="提交"/>
              </label>
                  
        </form>
    </body>
</html>

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-09-17 15:14
pigzee
Rank: 2
等 级:论坛游民
帖 子:20
专家分:69
注 册:2010-3-30
得分:2 
html 里面没有validata函数吧,你得自己写才可以验证啊。
你可以在ie8 或者 firefox中debug一下。
2010-09-21 10:24



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-320692-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.200255 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved