想用html做一个静态登录界面,可以验证密码的。不用带素材
参考下面代码
<form method="post" action="###" name="myform" onsubmit="checkpost()">
<label for="name">用户名:</label><input type="text" name="name" id="name" /><br />
<label for="pw">密码:</label><input type="password" name="pw" id="pw" /><br />
<input type="submit" value="提交" />
</form>
<script>
function checkpost(){
if(document.forms[0].name.value=="要的用户名"&&document.forms[0].pw.value=="要的密码"){
window.location="要跳转的地址";
}else{
alert("用户名或密码不正确!")
return false;
}
}
</script>
<form method="post" action="###" name="myform" onsubmit="checkpost()">
<label for="name">用户名:</label><input type="text" name="name" id="name" /><br />
<label for="pw">密码:</label><input type="password" name="pw" id="pw" /><br />
<input type="submit" value="提交" />
</form>
<script>
function checkpost(){
if(document.forms[0].name.value=="要的用户名"&&document.forms[0].pw.value=="要的密码"){
window.location="要跳转的地址";
}else{
alert("用户名或密码不正确!")
return false;
}
}
</script>
温馨提示:答案为网友推荐,仅供参考