Jump to content

[SOLVED] Problem on drop down box


peddel

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.