...

View Full Version : Setting up an Option Group in JavaScript?



DanielHowden
12-23-2010, 02:54 PM
So this is how I setup an item in the list and it works fine but I can't fine the syntax for setting an option group in javascript.

Cheers Daniel.


Users[0] = new Option("Text to show in list", "Item Value");

Logic Ali
12-23-2010, 03:28 PM
Google -> javascript +create +optgroup (http://www.google.co.uk/search?q=javacript+%2Bcreate+%2Boptgroup&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a#sclient=psy&hl=en&client=firefox-a&hs=C5S&rls=org.mozilla:en-GB%3Aofficial&q=javascript%20%2Bcreate%20%2Boptgroup&aq=&aqi=&aql=&oq=&gs_rfai=&pbx=1&fp=95df9a7a7554afa0&pf=p&pdl=1000)

DanielHowden
12-24-2010, 02:37 PM
I had already done that and not come up with anything that I can use with my example.

Can anyone else help with this specific problem?

Basically do I have to completely re-write what I have if I want to add an option group or can I modify it?

Cheers Daniel.



var Users = new Array;
Users[0] = new Option("Text to show in list", "Item Value");

for(i=0; i<Users.length; i++) {
document.newforms.TelephoneSelection.options[i] = Users[i];
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum