已經創建了一個基本表單,三個下拉列表和一個按鈕。即時通訊嘗試將下拉列表中的三個值相乘。我必須將數據傳遞給函數。我已經跑了代碼只是不斷得到0作爲結果?我不認爲我正確地將數據從功能傳遞給功能?javascript函數參數
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
<script>
function multiply(number1, number2, number3)
{
var firstnum=0;
var secondnum=0;
var thirdnum=0;
var answer;
firstnum=parseInt(number1);
secondnum=parseInt(number2);
thirdnum==parseInt(number3);
answer=(firstnum*secondnum*thirdnum);
alert(answer)
}
</script>
<form name="Example1">
Number 1:
<select id="num1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<br/>
Number 2:
<select id="num2">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<br/>
Number 2:
<select id="num3">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<br/>
<input type=button value="muliply" onclick="multiply(num1.value, num2.value, num3.value)" />
</form>
</body>
</html>
請嘗試檢查句法是否正確... @ Francis Gall –