SimpleButton2 (Javascript): SimpleButton2.html

<html>
<head>

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

<script>

function buttonPressed (str) { //*1 Reach into HTML text and change it
      statusmsg.textContent = //*1
      	"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>
[download file]