Onclick Dynamically Set

[Total: 0    Average: 0/5]

This example will change the onclick event handler by clicking on the set function 1 or set function 2 buttons

Body Code:

function fcnOne(){alert("Function One");}
function fcnTwo(){alert("Function Two");}
var _whatToDo= new Array();
    /* these numbers [1] and [2] must correspond with */
	/* the values in the doIt(#) in the form */
function doIt(_f,_v)
  /* kill the button effect */
  return false;

<form name=exf1>
<input type=button name=b1 value="click me">
<input value="Set Function 1" type=button onclick="return doIt(document.exf1,1)">
<input value="Set Function 2" type=button onclick="return doIt(document.exf1,2)">

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *