peddel Posted August 8, 2008 Share Posted August 8, 2008 Well i got this far by now : <select name="ploeg" size="1"> <option value="vroeg" selected="selected">Vroege ploeg</option> <option value="laat">Late ploeg</option> <option value="nacht">Nacht ploeg</option> </select> This dropdownbox is placed inside a form with the name "formulier" and its the only form that is included in my page. With javascript i made the following to extract the value that is selected : var ploegTemp = document.forms[0].elements["ploeg"]; for(i=0;i<ploegTemp.length;i++){ if(ploegTemp.selectedIndex !=0){ var ploeg = ploegTemp.options[ploegTemp.selectedIndex].value; } } Now thing is when i wanna test that value by prompting it, then i use alert(ploeg). BUT it keeps saying its undefined. Can someone help out? Link to comment https://forums.phpfreaks.com/topic/118764-solved-problem-on-drop-down-box/ Share on other sites More sharing options...
peddel Posted August 8, 2008 Author Share Posted August 8, 2008 I found it with help from friend : var ploeg = document.forms[0].ploeg.options[document.forms[0].ploeg.selectedIndex].text; Hope this can help others Link to comment https://forums.phpfreaks.com/topic/118764-solved-problem-on-drop-down-box/#findComment-611487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.