我有以下簡明的形式獲得一個選擇的價值與JavaScript
<form name="thecars">
<select name="cars">
<option value="mustang">Mustang</option>
<option value="pinto">Pinto</option>
<option value="pinto">Chevelle</option>
<option value="pinto">Other</option>
</select>
</form>
我想通過以下獲取所選汽車的價值,但它不工作
selectedCar = document.forms["thecars"].elements["cars"].options[thecars.cars.options.selectedIndex].value;
哦,對不起,這是一個錯字。=在那裏。 – Mike 2011-01-18 21:57:43
@Mike,好吧。我編輯了你的帖子加入。 – 2011-01-18 22:00:28