2
我有以下功能来验证手机号码。验证手机号码。的用户
function validate()
{
var a = document.form.mobile_no.value;
if(a=="")
{
alert("please Enter the Contact Number");
//document.form.mobile_no.focus();
return false;
}
if(isNaN(a))
{
alert("Enter the valid Mobile Number(Like : 9566137117)");
//document.form.mobile_no.focus();
return false;
}
if((a.length < 1) || (a.length > 10))
{
alert(" Your Mobile Number must be 1 to 10 Integers");
//document.form.mobile_no.select();
return false;
}
}
我称从形式作为功能:
<form action="" method="post" onsubmit="validate()" id="teacher_form">
和来自用户的输入被取为:
但这个过程并不验证结果,因为它应该。该条目被接受而没有输入验证。
在提交之前是否看到任何'alert()'? –
为什么不允许使用“+ 91-9566137117”? – hjpotter92
你如何提交表格? –