Hi!
I have a problem when I programaticaly define onchange event to select tag.
the working code looks like this:
non-working code:
I need to define onchange event programmaticaly.
I use IE 6.
Can anybody help,
thnx,
T.
Tomi Hrovatin
I have a problem when I programaticaly define onchange event to select tag.
the working code looks like this:
Code:
var d = document;
//create select element
var tmp = "<select id='selectID' onchange='alert()'>";
var s = d.createElement(tmp);
//append select element to a div on page
div.appendChild(s);
non-working code:
Code:
var d = document;
//create select element
var tmp = "<select id='selectID'>";
var s = d.createElement(tmp);
//append select element to a div on page
div.appendChild(s);
selectID.onchange = "alert()";
//or
s.onchange = "alert()";
//or
s.onchange = function {alert()};
I need to define onchange event programmaticaly.
I use IE 6.
Can anybody help,
thnx,
T.
Tomi Hrovatin