FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[JS] selecting an option from a drop down box





jasperlevink
Hello Folks!

Via google I can find much information about how to find out which option from a drop-down box is selected. But I'd like to select one myself when a function is runned.

How do I have to do that?

Grtz.
Jasper


***************************
DUTCH:

Hallo mensen!

Via google kan ik een hoop informatie vinden over hoe ik erachter kom hoe ik bepaal welk item in een drop-down box is geselecteerd. Echter, hoe kan ik bepalen welk item geselecteerd wordt.

Ik wil bij het laden van de pagina één van de items (niet de eerste, de items worden bevatten door Javascript gegenereerde content) selecteren.

Groeten.
Jasper
Stubru Freak
document.getElementById("RadioBoxName").checked=true;

You mean this?
jasperlevink
I meant a drop-down box.
This should be something like
document.getElementById("DropDownBoxName").selected=true;
??

THanks!
Stubru Freak
jasperlevink wrote:
I meant a drop-down box.
This should be something like
document.getElementById("DropDownBoxName").selected=true;
??

THanks!


Oh sorry, you're right. Got this code from my own page with radio buttons.
jasperlevink
Quote:
document.getElementById("DropDownBoxName").selected=true;


Has to be:
document.getElementById("DropDownBoxName").Option[a].selected=true;

with a the optionnumber (starts at zero)
Related topics
IP => Country => Drop Down Box!
I need a Drop Down Bar Paying 100 FRIH$
"Drop Down List Box" Using PHP and MySql
set selected value in drop down
Open cart VQMOD - drop down option
Question About Drop-Down search buttons
help on a drop down menu!! Please Read!!
Javascript: Drop Down Box Help
PHP Dropdown Selection
Menu + drop down
Dragonfly install tutorial
help add admin in phpbb forum
Drop down menu things
Javascript Drop down menus
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.