我有这个表格:
<form id="frm_register" action="register.php" method="post" onsubmit ="return register_user()">
<label for="txtuname" style="display: block; width: 80px; float: left;">Username: </label>
<input id="txtuname" name="ntxtuname" type="text" style="" /><br /><br />
<label for="txtupwd" style="display: block; width: 80px; float: left;">Password: </label>
<input id="txtupwd" name="ntxtupwd" type="password" style="" /><br /><br />
<label for="txtuemail" style="display: block; width: 80px; float: left;">Email: </label>
<input id="txtuemail" name="ntxtuemail" type="text" style="width:200px;" /><br /><br />
<label for="txtpayza" style="display: block; width: 80px; float: left;">Payza: </label>
<input id="txtpayza" name="ntxtpayza" type="text" style="width:200px;" /><br /> <br />
<input type="submit" value="Register" style="margin-left: 250px;"/>
</form>
还有一个 JavaScript 函数在提交之前验证表单:
<script type="javascript/text">
function register_user() {
if(document.frm_register.ntxtuname.value=='') {
alert('wrong');
return false;
}
return true;
}
</script>
但是表单仍然提交并且没有进行验证。伙计们,这张照片有什么问题?