hold the door:谁能给我看看这个脚本?

来源:百度文库 编辑:神马品牌网 时间:2024/04/27 16:43:24
这是.html文件

<html>
<head>
<script language="javascript" src=1.js"></script>
</head>
<body>
<form name="form1">
姓名:<input type="text" name="name"><br>
密码:<input type="text" name="password"><br>
e-mail:<input type="text" name="email"><br>
<input type="submit" value="确定" onclick="check()">
</body>
</html>

这是1.js文件

function check(){
var name=document.form1.name.value;
var password=document.form1.password.value;
var email=document.form1.email.value;

if(name=="")
{
alert("姓名不能为空");
document.form1.name.focus();
return false;
}

if(password=="")
{
alert("密码不能为空!");
document.form1.password.focus();
return false;
}

if(email=="")
{
alert("email不能为空!");
document.form1.email.focus();
return false;
}

}

我把他们放在同一个目录下了!
实现不了!即使不添也不能弹出框!

你想问什么。。看了又想怎么样?

这是一个很简单的网页用户登陆的脚本,没什么深奥的东西。