javascript中的函数调用问题

purpledaisy110 2009-12-24 09:22:28
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>新用户注册</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.STYLE1 {
font-size: 12px
}
.STYLE3 {
font-size: 12px;
font-weight: bold;
}
.STYLE5 {font-family: "宋体"}
-->
</style>
<script language="JavaScript">
function register(){ //注册员工信息的脚本
if(document.form.account.value==""){
window.alert("请填写账号");
return false;
}
if(document.form.password.value==""){
window.alert("请输入密码");
return false;
}
if(document.form.spassword.value==""){
window.alert("请再填写密码");
return false;
}
if(document.form.password.value!=document.form.spassword.value){
window.alert("您两次输入的密码不一致,请重新输入");
return false;
}
if(document.form.name.value==""){
window.alert("请填写真实姓名");
return false;
}


return true;
}

</script>
</head>
<body><br>

<form action="" method="post" name="form">
<table border="1" width="400" align="center">
<tr>
<td width="130" background="images/bg.gif" bgcolor="#FFFFFF"> <span class="STYLE1">客户名</span></td>
<td width="200" class="STYLE1"><input type="text" name="name"></td>
</tr>

<tr>
<td class="STYLE1" background="images/bg.gif" bgcolor="#FFFFFF"><span class="STYLE1">密码</span></td>
<td class="STYLE1"><input type="text" name="password"></td>
</tr>

<tr>
<td class="STYLE1" background="images/bg.gif" bgcolor="#FFFFFF"><span class="STYLE1">确定密码</span></td>
<td class="STYLE1"><input type="text" name="spassword"></td>
</tr>

<tr>
<td class="STYLE1" background="images/bg.gif" bgcolor="#FFFFFF"><span class="STYLE1">真实姓名</span></td>
<td class="STYLE1"><input type="text" name="realname"></td>
</tr>

<tr>
<td class="STYLE1" background="images/bg.gif" bgcolor="#FFFFFF"><span class="STYLE1">安全提问</span></td>
<td class="STYLE1"><input type="text" name="question"></td>
</tr>

<tr>
<td class="STYLE1" background="images/bg.gif" bgcolor="#FFFFFF"><span class="STYLE1">答案</span></td>
<td class="STYLE1"><input type="text" name="answer"></td>
</tr>
</table>
<br>
                        
                        
<input type="submit" name="submit"value="注册" onClick="register()">
</form>
</body>
</html>
...全文
43 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
purpledaisy110 2009-12-24
  • 打赏
  • 举报
回复
哦,谢谢啊!!
孟子E章 2009-12-24
  • 打赏
  • 举报
回复
另外,最好不要使用form、name等这些单词做名字
孟子E章 2009-12-24
  • 打赏
  • 举报
回复
onClick="return register()">

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧