Kopi Paste aja script dibawah ini....
<form name="inputin">
<table border=0>
<tr><td colspan=2><center>Luas Persegi Panjang</center></td></tr>
<tr><td>Panjang = </td><td><input type="text" name="p" size="10"></td></tr>
<tr><td>Lebar = </td><td><input type="text" name="l" size="10"></td></tr>
<tr><td>Hasil = </td><td><input type="text" name="luas" size="10"></td></tr>
<tr><td colspan=2><p align=center><input type="button" value="Proses" onclick="proses();"><input type=button value=Hapus onclick="hapus();"><input type=button value=Keluar onclick="keluar();"></p></td></tr></table>
</form>
<script language="javascript">
function hapus()
{
document.inputin.p.value="";
document.inputin.l.value="";
document.inputin.luas.value="";
}
function keluar()
{
window.close();
}
function proses()
{
panjang=document.inputin.p.value
lebar=document.inputin.l.value
if (panjang == 0)
{
document.inputin.luas.value="";
}
else if (lebar == 0)
{
document.inputin.luas.value="";
}
else
{
document.inputin.luas.value=panjang*lebar;
}
}
</script>
Saturday, 13 April 2013
Subscribe to:
Post Comments (Atom)
0 komentar:
Post a Comment