Menampilkan Table yg di hidden

Kurosaki · Oct 2, 2011
Bagaimana cara menampilkan tabel yg di hidden?
Saya ada 2 tabel seperti berikut:
<form method="POST">
<!--- tabel1 -->
<div id="form1">
<table>
  <tr>
    <td>a</td>
    <td>b</td>
    <td>c</td>
  </tr>
  <tr>
    <td><input type="sumbit" name="btnUpdate" value="Update"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<?php
if($_POST['btnUpdate']){
   echo "<script type='text/javascript'>
      form1.style.display='none';
   </script>";
   echo "<script type='text/javascript'>
      form2.style.display='';
   </script>";
?>
<!--- tabel2 -->
</div>
<div id="form2" style="display:none">
<table>
  <tr>
    <td>d</td>
    <td>e</td>
    <td>f</td>
  </tr>
  <tr>
    <td><input type="sumbit" name="btnSubmit" value="Submit"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</div>
</form>
Terima kasih...
Silahkan login untuk menjawab!
1
Loading...
Ellyx Christian · Oct 3, 2011 · 1 Suka · 0 Tidak Suka
<form method="POST">
<!--- tabel1 -->
<div id="form1" <?php echo $_POST['btnUpdate'] ? 'style="display:none"': ''; ?>>
<table>
  <tr>
    <td>a</td>
    <td>b</td>
    <td>c</td>
  </tr>
  <tr>
    <td><input type="sumbit" name="btnUpdate" value="Update"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<!--- tabel2 -->
</div>
<div id="form2" <?php echo $_POST['btnUpdate'] ? '' : 'style="display:none"'; ?>>
<table>
  <tr>
    <td>d</td>
    <td>e</td>
    <td>f</td>
  </tr>
  <tr>
    <td><input type="sumbit" name="btnSubmit" value="Submit"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</div>
</form>
0
Loading...
Kurosaki · Oct 4, 2011 · 0 Suka · 0 Tidak Suka
terima kasih kak... :)