Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with mozilla firefox browser while creating dynamic dropdown list  RSS feed

 
sruthi reddy
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
In my application, i am crreating a dynamic drop down list using javascript and its working fine when i am using IE browser. If i am trying same with firefox, its not wotking. Can anyone suggest me how to solve this issue. Here is the code which i am using.

function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

Problem is with the line " selectbox.options.add(optn); ". Can anyone suggest me alternate option or how to make this work.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I recall correctly, W3C standards, which of course IE ignores almost completely, dictate a second parameter to the add() method that specifies the position of the option in the list.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!