Advertisement
cdsatrian

contoh validasi sederhana

Jun 24th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.71 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset='utf-8'/>
  5.         <title>Simple Validation</title>
  6.       <script type="text/javascript">
  7.         function validasi(frm){
  8.           if(parseFloat(frm.bayar.value)>parseFloat(frm.tagihan.value)){
  9.             alert('kelebihan..');
  10.           }else{
  11.             frm.submit();
  12.           }
  13.         }
  14.       </script>
  15.     </head>
  16.     <body>
  17.       <form name="frm" method="post" action="#1" onsubmit="validasi(this);return false;">
  18.         <label>tagihan anda<label>
  19.         <input type='text' name='tagihan' id='tagihan' value='200000'/><br />
  20.         <label>bayar tagihana<label>
  21.         <input type='text' name='bayar' id='bayar' value=''/><br />
  22.         <input type='submit' value='submit'/>
  23.       </form>
  24.     </body>
  25. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement