Posts

Showing posts with the label JavaScript

Pan Card Validation Using Javascript

To Validate PanCard you have to use below function  function ValidatePAN(Obj) {            if (Obj.value != "") {             ObjVal = Obj.value;             var panPat = /^([a-zA-Z]{5})(\d{4})([a-zA-Z]{1})$/;             if (ObjVal.search(panPat) == -1) {                 alert("Invalid Pan No");                 Obj.focus();                 return false;             }         }   } <input type="text" ID="textPanNo" MaxLength="10" onblur="ValidatePAN(this);">

Javascript Phone Number Validation

JavaScript Phone Number Validation  Notes : Fresher Need to Understand Regular Expression. We made Phone number validation example after lots of trial, help using regular expression. you can check with following format. xxx-xx-xxxxxx <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html>  <head>   <title> Phone Number Validation Example </title>   <meta name="Generator" content="EditPlus">   <meta name="Author" content="">   <meta name="Keywords" content="">   <meta name="Description" content="">   <script type="text/javascript">   <!--     function ValidateForm(){         var ValidString = document.forms["myform"]["txtPhone"].value;         var regexObj = /^\(?([0-9]{3})\)?[-. ]?([0-9]{2})[-. ]?([0-9]{8})$/;      

Javascript random image display script

Copy following code and past into your page and change image name only. <script type="text/javascript" language="javascript"> function randomads() { var ads = new Array(); im[0] = "image1.gif"; im[1] = "image2.gif"; var adlinks = new Array(); links[0] = "http://www.webin2.com"; links[1] = "http://www.webinsolution.com"; randnum=Math.floor(Math.random()*ads.length); document.write("<a href=" +links[randnum]+ " target=_blank> <img src=" +im[randnum]+ " border=0></a>") } finished </script>

Submit form without having submit button ?

Here is an example,how to avoid submit button to submit the form.here we have used jQuery form submit method. <html> <head> <title>Submit form without having submit button</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("a#submit").click(function(){ $("#target").submit(); }); }); </script> </head> <body> <form method="post" id="target" action="test.php"> What's your ice cream flavor ? <input type="text" name="flavor" /> <a href="#" id="submit">Submit</a> </form> </body> </html>