1
我有這樣的代碼來計算結果(乘數* 5),但它讓我看到成果轉化爲<div id="total"></div>
顯示結果爲輸入文本
<script type="text/javascript">
function calculate(multiplier) {
var product = multiplier*5;
document.getElementById('total').innerHTML = product;
}
</script>
<form>
<select name="multipliers" onchange="calculate(this.value)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<div id="total"></div> <!-- result is displayed here -->
<input type="text" id="total" readonly="readonly">
</form>
是否有可能顯示結果爲輸入文本不成一個div?
<input type="text" id="total" readonly="readonly"> <!-- I'd like to show result here -->
不客氣。感謝您的關注。 – tanaydin