CONTOH PROGRAMNYA
<html>
<head>
<title>latihan 1</title>
</head>
<body>
<script>
function jumlah()
{
var a,b,max;
a=parseInt(document.getElementById("aaa").value);
b=parseInt(document.getElementById("bbb").value);
if(b>a)
{
max=b;
}
else
{
max=a;
}
document.getElementById('ccc').value=max;
}
</script>
<table border="1px" align=center bgcolor=green>
<tr>
<td>
A :</td>
<td><input type="text" name="A" size="20" maxlength="20" id="aaa">
<br></td>
</tr>
<tr>
<td>
B :</td>
<td><input tyle="text" name="B" size="20" maxlength="20" id="bbb">
<br></td>
</tr>
<tr>
<td colspan="2" width="200" ><input type="button" value="maksimun" onclick="jumlah()"></td>
</tr>
<tr>
<td>maksimun:</td>
<td><input tyle="text" name="hasil" size="20" maxlength="20" id="ccc">
<br></td>
</tr>
</table>
</body>
</html>
Tidak ada komentar:
Posting Komentar