function otherShow() {
var textarea = document.getElementById("hideme");
var x = document.forms.myForm.other_trade.value;
if (x == "other") {
textarea.style.display = 'block';
}else {
textarea.style.display = 'none';
}
}
这是我的 JavaScript 代码,它应该隐藏包含ID=hideme
和触发操作的文本区域onchange="otherShow();"
<select name="trade" required="required" class="inputbox" id="trade" onchange="otherShow();">
<option value="" selected="selected"> Select one... </option>
<option value="" disabled="disabled"> ---------------------- </option>
<option value="General Labourer">Option1</option>
.......
</select>
上面是Select,下面是Textarea
<textarea cols="36" rows="6" class="inputbox" id="hideme" name="other_trade"></textarea>
在选择结束时,我有一个
<option value="Other"> Other </other>
我想在选择其他时显示文本区域。请帮助我认为 loginc 是正确的,但是当我将其更改为某个值时它不起作用,它会隐藏文本区域,但不要更改它...