我正在一個窗體中,我想採取選擇值,當用戶選擇是值,然後我想顯示一個文本框部分,但下面的代碼不適合我。 請告訴我哪裏錯了我在這裏:任何人都可以告訴我哪裏錯了這個PHP代碼,而選擇選項?
<select id="gap" name="gap" onclick="gap_textbox();">
<option value='select'>Select</option>
<option value='yes'>Yes</option>
<option value='no'>No</option>
</select>
<input type="text" name="gap_box" id="gap_text_box" />
<script type="text/javascript">
function gap_textbox() {
alert ("am here" + " " +document.getElementById("gap").value);
if (document.getElementById("gap").value =='select') {
alert ("in value = select");
document.getElementById("gap_text_box").disable=true;
}
else if (document.getElementById("gap").value =='no') {
alert ("in value = no");
document.getElementById("gap_text_box").disable=true;
} else {
alert ("in value = yes");
document.getElementById("gap_text_box").disable=false;
}
}
</script>
使用以下功能。 – Sahal