Mobile No Validation javascript
How to validate mobile no in java script.
<HTML>
<head>
<script>
function ToCellValidate(objText)
{
if(objText.value!="")
{
if(objText.value.length < 9 || objText.value.length > 15 || objText.value.search(/[^0-9\-()+]/g) != -1 )
{
alert('Please enter valid mobile number');
objText.focus();
objText.value.value="";
return false;
}
else{
alert("valid mobile number");
return true;
}
}
}
</script>
</head>
<BODY>
<input type="text" name="text" id="text"><br/><input type="submit" name="validate" value="validate" onclick=ToCellValidate(document.getElementById('text'));>
</BODY>
</HTML>
<HTML>
<head>
<script>
function ToCellValidate(objText)
{
if(objText.value!="")
{
if(objText.value.length < 9 || objText.value.length > 15 || objText.value.search(/[^0-9\-()+]/g) != -1 )
{
alert('Please enter valid mobile number');
objText.focus();
objText.value.value="";
return false;
}
else{
alert("valid mobile number");
return true;
}
}
}
</script>
</head>
<BODY>
<input type="text" name="text" id="text"><br/><input type="submit" name="validate" value="validate" onclick=ToCellValidate(document.getElementById('text'));>
</BODY>
</HTML>
Give javascript code for telephone validation and income validation
ReplyDelete