【发布时间】:2014-06-11 23:46:30
【问题描述】:
以下代码产生 JavaScript 错误: Uncaught TypeError: undefined is not a function: 订货量 改变
据我所知,这个脚本应该可以工作。我已经用谷歌搜索了这个问题,所有的建议都涉及重命名事物,因此它们不会发生冲突,但我确保我没有冲突的元素名称或 ID。
这可能是印刷问题,但我找不到问题。请帮忙。
<script type="text/javascript">
function orderquantity(myvalue)
{
if (myvalue == "Custom") {
document.getElementByID('cquant').style.display="inline-block";
}else{
document.getElementByID('cquant').style.display="none";
document.getElementByID('customquant').value="";
}
}
</script>
<select name="quantity" id="quant" onchange="orderquantity(this.selectedIndex);">
<option value="MatchLast" selected="selected">Same as Last Time</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="2500">2500</option>
<option value="5000">5000</option>
<option value="10000">10000</option>
<option value="Custom">Custom Quantity</option>
</select>
<div id="cquant" style="display: none;">
<input type="text" name="CustomAmount" id="customquant">
</div>
【问题讨论】:
标签: javascript html forms onchange