View Full Version : dynamic menu, value but no text in IE

05-05-2006, 07:10 PM
I am creating a dynamic menu for years (2005->...), which works fine in FF but in IE the value is created and is selectable, but text is blank. I have encountered this problem 3 times, but I was not able to find any other posts on the subject and I still don't have a solution, so perhaps I am going about it all wrong. Is there another way to insert text into an option element other than what I've done below? Has anyone else encountered this problem? PLEASE HELP!

Here is my code:

var yr = new Date();
yr = yr.getFullYear();
for (var i = 2005; i <= yr; i++) {
var opt = document.createElement("option");
opt.setAttribute("value", i);
opt.text = i;

05-06-2006, 01:09 AM
Try using this way to add options instead. (http://www.quirksmode.org/js/options.html)

05-06-2006, 10:38 PM
I found this site yesterday and tried using new Option() and the menu.options.add(opt), but had the same result. The menu was generated with values, but no text so it appears blank (in IE). Thanks for the input though, I've been having a lot of trouble getting ANY response to this problem. If you have any other ideas (even untested), please share.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum