On Apr 17, 10:59 am, javelin <google.1.jvm...@spamgourmet.comwrote:
I have this code to add an onChange event to a select control:
catid.attributes['onChange'].value= "FilterByCatID();";
alert(catid.attributes['onChange'].value);
The alert box confirms that the event has been set, but on change of
the selectbox, nothing happens. Any ideas what I'm missing?
You've created an "onChange" attribute with a string value, what you
want to do is assign a function to the onchange handler. The most
reliable way is to set it directly:
catid.onchange = FilterByCatID;
Also, it is a convention in javascript that function names starting
with a captial letter are reserved for constructors.
--
Rob