ASDV-WebDev/Semester 1/Chapter ZIPs/JavaScript/ch04/ex_4_16.html

29 lines
705 B
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Example 4.16</title>
<script>
function countBeans()
{
var i = 0;
beanImage = ("<img src = 'blue_bean.jpg' >");
document.write("<table align = 'center'><tr><td>");
document.write("<h1>&nbsp;<br /> Here are your beans:</h1>");
for (i = 0; i <= 7; i++)
document.write(beanImage + "&nbsp; &nbsp;");
document.write("</td></tr></table>");
}
</script>
</head>
<body>
<table align ="center" width ="70%"><tr><td colspan ="2">
<h1>&nbsp;</h2>
<h1>Count Beans!</h1>
<tr><td><p>&nbsp;</p>
<p><input type="button" id="beans" value="Click to count beans" onclick="countBeans();" /></p>
</td></tr>
</table>
</body>
</html>