以下是標題。 它將結果顯示在新頁面中,而我想在運行代碼的同一頁面顯示結果。請幫助。從下拉列表中獲取值並在Java腳本的同一頁面中顯示結果
function calculate() {
var width = document.getElementById("width");
width1 = width.options[width.selectedIndex].text;
var height = document.getElementById("height");
var height1 = height.options[height.selectedIndex].text;
var calculate = width1 * height1 * 3;
result.innerHTML = "<div>" + calculate + "</div>";
}
體
Choose Width
<select id="width" name="height" onchange="calculate()">
<option>1</option>
<option>1</option>
</select>
<br/>
Choose Heiht
<select id="height" name="height" onchange="calculate()">
<option>1</option>
<option>2</option>
</select>
意味着什麼下一頁 – PSR 2013-02-26 07:04:36
OP的意思是說,結果會在下一頁提交,但他希望在同一頁上更新/顯示結果 – asifsid88 2013-02-26 07:12:28