Type Your Phone No.and Submit[Validation]
Here let's see the validation for the phone number using simple javascript.Here is the script for the validation phoneno = /^\d{10}$/ . Using this script we can validate the phone number.Above is the live demo we can check by entering the alphabets and also numbers. By entering the alphabets we get the alert message as Not a valid Phone Number and by entering the Number we can get the alert message as Your Phone Number have accepted : you can try another.
Download Coding : Phonenumber Validation
Style :
<style type="text/css">
li {list-style-type: none;
font-size: 10pt;
}
.mail {
margin: auto;
padding-top: 10px;
padding-bottom: 10px;
width: 400px;
background : #CCC;
border: 1px soild silver;
}
.mail h2 {
margin-left: 68px;
}
input {
font-size: 15pt;
}
input:focus, textarea:focus{
background-color: lightyellow;
}
input submit {
font-size: 8pt;
}
.rq {
color: #FF0000;
font-size: 6pt;
}
.sub{margin-left:200px;width:100px; }
</style>
Script :
<script type="text/javascript"> function phonenumber(inputtxt) { var phoneno = /^\d{10}$/; if(inputtxt.value.match(phoneno)) { alert('Your Phone Number have accepted : you can try another'); return true; } else { alert("Not a valid Phone Number"); return false; } } </script>
Index :
<div class="mail"> <h2> Type Your Phone No.and Submit[Validation]</h2> <form action="#" name="form1"> <ul> <li><input name="text1" type="text" /></li> <li> </li> <li class="sub"><input name="submit" onclick="phonenumber(document.form1.text1)" type="submit" value="Submit" /></li> <li> </li> </ul> </form> </div>
I’m not sure exactly why but this web site is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I’ll check back later on and see if the problem still exists.
ReplyDeleteEmail Validation Service