请教一段代码!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/06/20 08:39:00
<script language=JavaScript>
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
function passcheck()
{
if(document.userpass.userpassword.value.length < 6 || document.userpass.userpassword.value.length >20) {
document.userpass.userpassword.focus();
alert("密码长度不能不能这空,在6位到20位之间,请重新输入!");
return false;
}
if(document.userpass.userpassword.value!==document.userpass.userpassword2.value) {
document.userpass.userpassword.focus();
alert("对不起,两次密码输入不一样!");
return false;
}
}
</script>

fall830424 你现在干什么?怎么老师提问这种问题?checkspace这一段是如果字符串长度不够,在后面补空格,passcheck这一段是密码比较程序,如果你两次输入的密码不一样或者密码长度<6 》20,则返回失败

这是小脚本阿
怎么啦?

这个段JavaScript的脚本,他的语法和Java的语法基本上是一样的。你想问什么?