onblur在html中的作用

来源:互联网 发布:crass软件 编辑:程序博客网 时间:2024/06/11 19:55

 eg:

onblur在html中的作用:当控件在失去聚焦时发生

<html>

<head>

<title>标题</title>

</head>

<script type="text/javascript">

function check()
{
    var password1 = document.all.password.value;
   
    var password2 = document.all.repassword.value;

    if(password1 != password2)
    {
        alert("密码不一致");
       
        return false;
    }
 }
  </script>    

</head>

<body>

密码<input name="password" type="password" class="STYLE3" size="20" />

确定密码<input name="repassword" type="password" class="STYLE3"  size="20" onblur="return check()"/>

</body>

</html>

原创粉丝点击