SimpleButton2 (Javascript)

SimpleButton2.html  [download]

<html>
<head>

<title>Comp 86 example SimpleButton2</title>
<!-- Similar to java SimpleButton3, using DHTML -->

<script type="text/javascript">

function buttonPressed (str) {
      document.getElementById("statusmsg").innerHTML = //*1 Reach into HTML and change it
      	"Button labeled '" + str + "' was pushed"; //*1
}

</script> 
</head>

<body>

<input type=button value="Push me"
	onclick="buttonPressed('Push me')">

<input type=button value="Push me also"
	onclick="buttonPressed('Push me also')">

<p>
<b>Status:</b>
<span id="statusmsg">(Nothing pushed)</span>
</p>
</body>
</html>