May 25, 2000 - Modifying the Button's Banner
May 25, 2000 Modifying the Button's Banner Tips: May 2000
Yehuda Shiran, Ph.D.
|
innerText
property of the button object. We change it in the event handler function:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function changeFace() {
if (oButton.innerText == "Option is Off") {
oButton.innerText = "Option is On"
}
else {
oButton.innerText = "Option is Off";
}
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<BUTTON ID="oButton" onclick="changeFace()">Option is On</BUTTON>
</BODY>
</HTML>
And here is a demonstration: