HTML网页设计:一个简单的登录界面可以连接到数据库记录的代码

html-css012

HTML网页设计:一个简单的登录界面可以连接到数据库记录的代码,第1张

如下参考:

1.首先,在您的计算机桌面上创建一个新文件夹,然后在该文件夹中创建一个新的文本文档。

2.然后用记事本双击打开文本文档,如下图所示,然后编写一个简单的HTML代码。

3.点击“另存为”功能选项,显示默认的“另存为”代码为ANSI。

4.我们将把编码和文件名更改回图中所示的图像并保存它。

5.然后回到新创建的文件夹,找到一个额外的HTML文件。

6.最后,使用浏览器打开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>

这是我曾经写过的一个登录页面的详细代码,供你参考,asp的代码,不知道你看得懂不?\x0d\x0a文件名是:deafaule.asp\x0d\x0a \x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a欢迎使用 \x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0afunction FrontPage_valid() {\x0d\x0a if (document.FrontPage_Form.loginName.value == "") {\x0d\x0a alert("请先输入 [用户名] !\n如果没有帐号请先 注册!")\x0d\x0a document.FrontPage_Form.loginName.focus()\x0d\x0a return false\x0d\x0a }\x0d\x0a else if (document.FrontPage_Form.loginName.value.length < 2) {\x0d\x0a alert("在 [用户名] 中,请至少输入 2 个字符!")\x0d\x0a document.FrontPage_Form.loginName.focus()\x0d\x0a return false\x0d\x0a }\x0d\x0a else if (document.FrontPage_Form.loginPassword.value == "") {\x0d\x0a alert("请输入[密码]!")\x0d\x0a document.FrontPage_Form.loginPassword.focus()\x0d\x0a return false\x0d\x0a }\x0d\x0a else if (document.FrontPage_Form.loginPassword.value.length < 5) {\x0d\x0a alert("在 [密码] 中,请至少输入 5 个字符!")\x0d\x0a document.FrontPage_Form.loginPassword.focus()\x0d\x0a return false\x0d\x0a }\x0d\x0a else if (document.FrontPage_Form.FrontPage_Yzm.value == "") {\x0d\x0a alert("请输入[验证码]!")\x0d\x0a document.FrontPage_Form.FrontPage_Yzm.focus()\x0d\x0a return false\x0d\x0a }\x0d\x0a else if (document.FrontPage_Form.FrontPage_Yzm.value.length != 5) {\x0d\x0a alert("在 [验证码] 中,请输入 5 位数字!")\x0d\x0adocument.FrontPage_Form.FrontPage_Yzm.focus()\x0d\x0a return false\x0d\x0a }\x0d\x0a else if (document.FrontPage_Form.FrontPage_Yzm.value.length == 5) {\x0d\x0a var i=0,ch\x0d\x0a for (i=0i\x0d\x0a \x0d\x0a \x0d\x0a\x0d\x0a\x0d\x0a用户名:\x0d\x0a \x0d\x0a\x0d\x0a \x0d\x0a \x0d\x0a\x0d\x0a密 码:\x0d\x0a \x0d\x0a\x0d\x0a \x0d\x0a \x0d\x0a\x0d\x0a验证码:\x0d\x0a \x0d\x0a \x0d\x0a\x0d\x0a\x0d\x0a \x0d\x0a \x0d\x0a\x0d\x0a\x0d\x0a \x0d\x0a \x0d\x0a\x0d\x0a\x0d\x0a \x0d\x0a \x0d\x0a\x0d\x0a如果您还没有帐号,请点此 注册\x0d\x0a\x0d\x0a \x0d\x0a \x0d\x0a \x0d\x0a \x0d\x0a Copyright© 2012 All Rights Reserved\x0d\x0a \x0d\x0a \x0d\x0a \x0d\x0a\x0d\x0a\x0d\x0a if (screen.width == 1440) {\x0d\x0a document.write("








")\x0d\x0a }\x0d\x0a else if (screen.width == 1280){\x0d\x0a document.write("



")\x0d\x0a }\x0d\x0a else {\x0d\x0a document.write("




")\x0d\x0a }\x0d\x0a\x0d\x0a建议使用 IE8.0或更高版本的浏览器,推荐分辨率1440×900 或更高
\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a