Add javascript validation in your website
JavaScript can be used to validate data in HTML forms before sending off the content to a server.
Form data that typically are checked by a JavaScript could be:
| |
<html><head><title>Free Trial</title> <style type="text/css"> .txt { color:#fff; } </style> <script language="JavaScript"> function validate() { if(document.info.nm.value == "") { alert("Please enter name"); return false; } if(document.info.mobile.value == "") { alert("Please enter mobile number"); return false; } } </script> </head> <body bgcolor="#000000"> <form name="info" action="send.php" method="post" onsubmit="return validate()"> <table border="0" cellpadding="4" cellspacing="0" width="100%"> <tr> <th colspan="2" class="txt"> <img src="images/free_trial.gif" /></th> </tr> <tr> <td class="txt"><br>Name: </td> <td><br><input type="text" name="nm" /></td> </tr> <tr> <td class="txt">Mobile Number: </td> <td><input type="text" name="mobile" maxlength="10" /></td> </tr> <tr> <td> </td> <td><input type="submit" value="Submit" /></td> </tr> </table></form></body></html> | |
0 comments:
Post a Comment