请注意[select* drop-down-menu id="OrderQuantity"] 快捷码不会为select输出任何id,因此您不能使用文档。getElementById,但您可以依赖name属性:
<label> Order Quantity
[select* drop-down-menu id=OrderQuantity "Select Quantity" "10" "20" "30" "40" "Other"] </label>
<label id="EnterOtherQuantity" style="display:none;"> Please Specify Your Order Quantity
[number other-order-quantity min:41] </label>
[submit "Send"]
<script language="javascript" type="text/javascript">
document.getElementsByName("drop-down-menu")[0].addEventListener("change", displayNumberField);
function displayNumberField() {
var dropDownText = document.getElementsByName("drop-down-menu")[0].value;
if (dropDownText == "Other") {
document.getElementById("EnterOtherQuantity").style.display = \'block\';
} else {
document.getElementById("EnterOtherQuantity").style.display = \'none\';
}
}
</script>