<head>
<title>登录</title>
</head>
<body>
<script type="text/javascript">
function checklog() {
if(loginform.username.value.length<1){
alert('用户不能为空!');
loginform.username.focus();
return false;
}
if (loginform.upw.value.length < 6) {
alert('密码不能少于6个字符!');
loginform.upw.focus();
return false;
}
if(loginform.upw.value!=loginform.upw2.value){
alert('确认密码错误!');
loginform.upw2.focus();
return false;
}
else {
alert('注册成功!');
return true;
}
}
</script>
<form action="reg.php" method="post" onsubmit="return checklog();" name="loginform">
用户: <input type="text" name="username" size="10" /><br/>
密码: <input type="password" name="upw" size="10"/><br>
确认密码:<input type="password" name="upw2" size="10"/><p>
<input type="submit" name="submit" value=" 注册 "/>
<input type="button" name="button" value="返回登录" onclick="window.location.href='login.php'";/>
</form>
</body>我的想法是在注册成功之后让他自动跳转到别页面"login.php",这个该怎么添加??
<?php
echo "<script>location.href='login.php';</script>"
?>
就可以了。