這是代碼,我想表現出牆根輸入時,我選擇選項「其他」,但它不工作Onchage選擇選項
<select id="transfer_reason" name="transfer_reason">
<option value="text">Text</option>
<option value="email">Email</option>
<option value="integer">Integer</option>
<option value="other">Other</option>
</select>
<input type="text" id="otherdetail" value="" style="display: none;" />
<script type="text/javascript">
window.onload = function() {
var eSelect = document.getElementById('transfer_reason');
var optOtherReason = document.getElementById('otherdetail');
eSelect.onchange = function() {
if(eSelect.options[selectedIndex].value == "other") {
optOtherReason.style.display = 'block';
}
else {
optOtherReason.style.display = 'none';
}
}
}
它工作時,使用的selectedIndex
if(eSelect.selectedIndex === 3) {
,但我想使用期權的價值
好,它現在的工作感謝 – hous