用javascript脚本语言编写的html登陆界面代码 怎么写啊 很急 拜托各位大大了。。。

就是这个样子就行了 还要有函数 在判断获得文本框输入的值:document.getElementById("name") 如果输入框中输入的是空格 网页会提示用户名或密码不能为空 如果是正确的密码或用户名(账号是admin 密码 admin 这是给好了的) 就会提示登录成功 最后就是 登录失败了

function submitForm() {
var name = document.getElementById('name');
var password = document.getElementById('password');
if(/^\s*$/.test(name.value) || /^\s*$/.test(password.value)) {
alert('用户名或密码不能为空');
return false;
} else if(name.value=='admin' && password.value =='admin') {
alert('登录成功');
return true;
} else {
alert('登录失败');
return false;
}
}

<form action="#" method="POST" onsubmit="return submitForm()" style="width:320px;">
<div>
<label style="display:inline-block;text-align:right;width:100px;">用户名:</label>
<input type="text" id="name" />
<span style="color:red">*</span>
</div>
<div>
<label style="display:inline-block;text-align:right;width:100px;">密码:</label>
<input type="password" id="password" />
<span style="color:red">*</span>
</div>
<div style="text-align:center">
<input type="submit" value="登录" />
<input type="reset" value="重置" />
</div>
</form>

追问

可以加下QQ么 还有点问题想问问 帮我看下代码哦

追答

加我的群吧 153445235

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网