Three Buttons Sharing One Function : Button : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » Button »

 

Three Buttons Sharing One Function



<HTML>
<HEAD>
<TITLE>Button Click</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function displayTeam(btn) {
    if (btn.value == "A") {alert("A")}
    if (btn.value == "R") {alert("R")}
    if (btn.value == "M") {alert("M")}
}
</SCRIPT>
</HEAD>
<BODY>
Click on your favorite half of a popular comedy team:<P>
<FORM>
<INPUT TYPE="button" VALUE="A" onClick="displayTeam(this)">
<INPUT TYPE="button" VALUE="R" onClick="displayTeam(this)">
<INPUT TYPE="button" VALUE="M" onClick="displayTeam(this)">
</FORM>
</BODY>
</HTML>

           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» Button