menampilkan gambar dengan menekan tombol
contoh programnya
<html>
<head>
<title> js-3 </title>
</head>
<body>
<table border="2px" width="800" height="400">
<tr>
<td><p id="satu"> </p><center> 1 </center></td>
<td><p id="dua"> </p><center> 2 </center></td>
<td><p id="tiga"> </p><center> 3 </center></td>
<td><p id="empat"> </p><center> 4 </center></td>
<td><p id="lima"> </p><center> 5 </center></td>
</tr>
<tr>
<td><center><button type="button"
onclick="document.getElementById('satu').innerHTML='<img src=aaa.jpg>'"> tombol 1 </button> </center></td>
<td><center><button type="button"
onclick="document.getElementById('dua').innerHTML='<img src=aaa.jpg>'"> tombol 2 </button> </center></td>
<td><center><button type="button"
onclick="document.getElementById('tiga').innerHTML='<img src=aaa.jpg>'"> tombol 3 </button> </center></td>
<td><center><button type="button"
onclick="document.getElementById('empat').innerHTML='<img src=aaa.jpg>'"> tombol 4 </button> </center></td>
<td><center><button type="button"
onclick="document.getElementById('lima').innerHTML='<img src=aaa.jpg>'"> tombol 5 </button> </center></td>
</tr>
</table>
</body>
</html>
Tidak ada komentar:
Posting Komentar