M
Mister Joe
I have a page and if the user has javascript enables I am trying to
dynamically change a link to a sitemap to a dropdown menu (that when
the option is changed will forward the user to another page). Here's
the code
try{
var sel = document.createElement("select");
sel.setAttribute("onchange", "alert('');");
for(var i=0;i<this.labels.length;i++){
var op = document.createElement("option");
op.value = this.hrefs;
op.appendChild(document.createTextNode(this.labels));
sel.appendChild(op);
}
var ql = document.getElementById("quicklinks");
ql.replaceChild(sel, ql.firstChild);
if(document.body){
alert(document.body.innerHTML);
alert(sel.getAttribute("onchange"));
}
}catch(e){alert(e.name+"\n"+e.message)
}
This works fine in firefox and when I display the generated html it
shows the select node w/ the appropriate onchange attribute in both ff
and ie. The problem is that the event is not working in ie. For some
reason changing the option does nothing. Any ideas? Also is this the
most unobtrusive way to achieve a quick links menu. Part of me is
considering just using an html/css vertical menu instead of a pull
down.
Thanks Guys
dynamically change a link to a sitemap to a dropdown menu (that when
the option is changed will forward the user to another page). Here's
the code
try{
var sel = document.createElement("select");
sel.setAttribute("onchange", "alert('');");
for(var i=0;i<this.labels.length;i++){
var op = document.createElement("option");
op.value = this.hrefs;
op.appendChild(document.createTextNode(this.labels));
sel.appendChild(op);
}
var ql = document.getElementById("quicklinks");
ql.replaceChild(sel, ql.firstChild);
if(document.body){
alert(document.body.innerHTML);
alert(sel.getAttribute("onchange"));
}
}catch(e){alert(e.name+"\n"+e.message)
}
This works fine in firefox and when I display the generated html it
shows the select node w/ the appropriate onchange attribute in both ff
and ie. The problem is that the event is not working in ie. For some
reason changing the option does nothing. Any ideas? Also is this the
most unobtrusive way to achieve a quick links menu. Part of me is
considering just using an html/css vertical menu instead of a pull
down.
Thanks Guys