therainmaker53 Posted February 12, 2007 Share Posted February 12, 2007 Hi Guys, I'm trying to create a drop down list (select list)using javascript, it works fine in FireFox but not in IE 6. (Not sure about 7) The code I am using is: var select = document.createElement('select'); select.setAttribute("name", "compChoice"); td2.appendChild(select); td2 is a td table element which work fine when dynamically created in other parts of the application. I also populate the select list using javascript from values from a xml document. I would be very grateful if anyone had any ideas on how to solve this problem? Thanks all, Sean. Link to comment https://forums.phpfreaks.com/topic/38087-dynamic-drop-down-list-select-list/ Share on other sites More sharing options...
ozfred Posted February 13, 2007 Share Posted February 13, 2007 I'm trying to create a drop down list (select list)using javascript, it works fine in FireFox but not in IE 6. (Not sure about 7) IE's support for the W3C DOM is patchy, especially in regard to select elements. var select = document.createElement('select'); select.setAttribute("name", "compChoice"); td2.appendChild(select); td2 is a td table element which work fine when dynamically created in other parts of the application. Just set the select element's properties directly; select.name = 'compChoice'; To insert options, use new Option() . <URL: http://www.quirksmode.org/js/options.html > -- Fred Javascript FAQ: <URL: http://www.jibbering.com/faq/ > Link to comment https://forums.phpfreaks.com/topic/38087-dynamic-drop-down-list-select-list/#findComment-183514 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.