An Example of Changing Event Handlers
<html> <head> <script language="JavaScript"> var choice = "A" function optionA() { alert('optionA' ); } function optionB() { alert('optionB' ); } </script> </head> <body> <form name="form1"> <input type="button" name="button1" onClick="optionA()"> </form> <script language="JavaScript"> if (choice != "A") { document.form1.button1.onclick=optionB } </script> </body> </html>