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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.