Advertisement
cdsatrian

multiinput

Dec 5th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <script>
  5.     function check(myvar){
  6.       var obj=myvar.nextSibling;
  7.       while(obj.nodeType!=1){
  8.         obj=obj.nextSibling;
  9.       }
  10.       obj.innerText=myvar.value;
  11.     }
  12.   </script>
  13. </head>
  14.   <body>
  15.   <form>
  16.   <?php
  17.      $jml=(isset($jml)?$jml:2);
  18.      echo "<input type='hidden' value='$jml' name='jml' id='jml'/>";
  19.      for($i=0;$i<$jml;$i++){
  20.       echo "<div class='input'>\n"
  21.           ."nim ".($i+1)."<input type='text' name='nim$i' id='nim$i' onblur='check(this);'/>\n"
  22.           ."<div name='hasil' id='hasil'></div>\n"
  23.           ."</div>";
  24.      }
  25.   ?>
  26.   </form>
  27.   </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement