<script language="JavaScript">
function checkForm()
{
var valid = false; valid = checkName();
if (valid==false)
{
window.alert("Invalid name.");
return false;
} valid = chekcIdentificationNumber()
if (valid==false)
{
window.alert("Invalid identification number.");
return false;
} // Do something like checking name and checking identification number.
// .... return true;
} function checkName()
{
var blacklist = "~!@#$%^&*()"; // All the invalid characters.
var name = document.form.textName.value;
for (int i = 0; i<name.length; i++)
if (blacklist.indexOf(name.charAt(i))>=0)
return false;
return true;
} // Put the checkIdentificationNumber() and other functions here like checkName().
</script><form name="form" onSubmit="return checkForm();" >
<input type="text" name="textName" />
<inpit type="text" name="textIdentificationNumber" />
<!-- Put the other input fields -->
</form>
function checkForm()
{
var valid = false; valid = checkName();
if (valid==false)
{
window.alert("Invalid name.");
return false;
} valid = chekcIdentificationNumber()
if (valid==false)
{
window.alert("Invalid identification number.");
return false;
} // Do something like checking name and checking identification number.
// .... return true;
} function checkName()
{
var blacklist = "~!@#$%^&*()"; // All the invalid characters.
var name = document.form.textName.value;
for (int i = 0; i<name.length; i++)
if (blacklist.indexOf(name.charAt(i))>=0)
return false;
return true;
} // Put the checkIdentificationNumber() and other functions here like checkName().
</script><form name="form" onSubmit="return checkForm();" >
<input type="text" name="textName" />
<inpit type="text" name="textIdentificationNumber" />
<!-- Put the other input fields -->
</form>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货