wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Problem with mozilla firefox browser while creating dynamic dropdown list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem with mozilla firefox browser while creating dynamic dropdown list" Watch "Problem with mozilla firefox browser while creating dynamic dropdown list" New topic
Author

Problem with mozilla firefox browser while creating dynamic dropdown list

sruthi reddy
Ranch Hand

Joined: Aug 03, 2008
Posts: 34
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

Joined: Jan 10, 2002
Posts: 60782
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with mozilla firefox browser while creating dynamic dropdown list
 
Similar Threads
Dynamic drop down list from an array
JSP variable typical problem
separate data with comma separated values and store them in a array
Drop Down List do not create when more elements added
putting values from ArrayList to optionlist/dropdownlist