码迷,mamicode.com
首页 > Web开发 > 详细

登陆与注册-js代码

时间:2014-07-23 22:23:27      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   java   color   os   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function check(flag){
    var name2=document.formname.name1;
    var password2=document.formname.password1;
    if(name2.value==""){
        alert("用户名不能为空");
        name2.focus();
        return false;
    }
    if(password2.value==""){
        alert("密码不能为空")
        password2.focus();
        return false;
    }
    if(flag==1){
        document.formname.action="5秒后跳转.html";
    }else if(flag==2){
    document.formname.action="123.jsp";
    }
    document.formname.submit();
}
</script>
</head>
<body>
<form  name="formname" method="post" ">
用户名:<input type="text" name="name1"  /><br />
密码:<input type="password" name="password1"  /><br />
<input type="button"  value="登陆"  onclick="check(1)"/>
<input type="button" value="注册"  onclick="check(2)" />
</form>
</body>
</html>

登陆与注册-js代码,布布扣,bubuko.com

登陆与注册-js代码

标签:style   blog   http   java   color   os   

原文地址:http://www.cnblogs.com/yunmengxiaohe/p/3864071.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!