Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dynamic menu, value but no text in IE

    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:
    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;						
       menu.appendChild(opt);
    }

  • #2
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

  • #3
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •