日期:2014-05-16 浏览次数:20362 次
<script type='text/javascript' src='prototype.js'></script> <script type='text/javascript' src='validation.js'></script> <script type='text/javascript' src='effects.js'></script>
<style> input.disabled { border: 1px solid #F2F2F2; background-color: #F2F2F2; } input.required, textarea.required { border: 1px solid #00A8E6; } input.validation-failed, textarea.validation-failed { border: 1px solid #FF3300; color : #FF3300; } input.validation-passed, textarea.validation-passed { border: 1px solid #00CC00; color : #000; } .validation-advice { margin: 5px 0; padding: 5px; background-color: #FF3300; color : #FFF; font-weight: bold; } </style>
<form id="test" action="#" > <table border="1px"> <tr> <td class = "label">Username</td> <td><input type="text" name="username" id = "username" class="required"></td> </tr> <tr> <td class = "label">Telephone Number</td> <td><input type="text" name="telephoneNumber" class="required validate-alphanum" id = "telephoneNumber"></td> </tr> <tr> <td colspan = "2" align = "center"> <button class = "submit" id = "search">Search</button> </td> </tr> <table> </form> <script> var valid = new Validation('test', {immediate : true}); </script>