我有一个表单的javascipt函数。该代码是:Javascript验证多个功能?
<script type="text/javascript">
function verify() {
if (isNaN(document.form1.exp_amount.value) == true) {
alert("Invalid Block Amount");
return false;
} else if ((document.form1.exp_name.value).length == 0) {
alert("Block Exp is left Blank!");
return false;
} else if ((document.form1.exp_amount.value).length == 0) {
alert("Block Amount is left Blank!");
return false;
} else {
document.form1.submit();
return true;
}
}
</script>
,现在我必须为它提供字母验证,我有它在单独的JS功能:
<script language="javascript" >
function checkName() {
re = /^[A-Za-z]+$/;
if (re.test(document.exp_name.form1.value)) {
alert('Valid Name.');
} else {
alert('Invalid Name.');
}
}
</script>
如果我想有字母验证内部功能验证() ..我怎么能这样做?或者还有其他方法吗?
你有没有想过你的缩进代码? – ThiefMaster 2011-03-24 07:26:26