本节内容:
一例登陆成功后自动查秒跳转的代码。
1,登录页面 login.html
<script language="javascript" type="text/javascript">
function $(id){
return document.getElementById(id);
}
function checkUser(){
if($("u1").value == "hello" && $("p1").value == "123"){
return true;
}else{
return false;
}
}
</script>
<form action = "ok.html">
<div style = "width:300px;height:200px;border:1px solid red;background-color:pink">
<p/>
U:<input id = "u1" type = "text" value = "" /> <br><br>
P:<input id = "p1" type = "text" value = "" /> <br><br>
<input type = "submit" onclick = "return checkUser()" value = "登陆" style = "margin-left:20px"/>
</div>
</form>
2,跳转页面 ok.html
3,manage.html
welcome
演示截图: