function changeRamps()
{
var hwys=document.getElementById('hwys');
document.write("selected high way "+hwys.selectedIndex);
document.write("selected high way is"+hwys.options hwys.selectedIndex].value); // I am not getting anything
}
<select id="hwys" onchange="changeRamps()">
<option>5</option>
<option>52</option>
</select>
The first document.write prints out correctly.
The second document.write isn't workin. I am just trying to print out which highway is selected, but I can't access the option element.
{
var hwys=document.getElementById('hwys');
document.write("selected high way "+hwys.selectedIndex);
document.write("selected high way is"+hwys.options hwys.selectedIndex].value); // I am not getting anything
}
<select id="hwys" onchange="changeRamps()">
<option>5</option>
<option>52</option>
</select>
The first document.write prints out correctly.
The second document.write isn't workin. I am just trying to print out which highway is selected, but I can't access the option element.