我搜索了互联网、图书馆和其他十几个无法提供答案的东西。这是我的 .js 文件
// JavaScript Document
function calculate()
{
var form = document.getElementById("calc");
var text1 = document.getElementById("calculator9").value-0;
var text2 = document.getElementById("calculator13").value-0;
var x = parseFloat(text1.value);
var y = parseFloat(text2.value);
var out = document.getElementById("calculator21").value = "$" + ((x * y) * 0.0016) - ((x * y) * 0.00085);
}
这是我在计算器页面上的表格
<form id="calc" name="calc" method="post" action="">
<div id="calculator8"> </div>
<div id="calculator9"><input type="text" name="x" class="box1" /> </div>
<div id="calculator10"> </div>
<div id="calculator11"> </div>
<div id="calculator12"> </div>
<div id="calculator13"><input type="text" name="y" class="box2" /> </div>
<div id="calculator14"> </div>
<div id="calculator15"> </div>
<div id="calculator16"> </div>
<div id="calculator17"><input type="submit" name="submit" class="button" value="" onclick="calculate()" /></div>
<div id="calculator18"> </div>
<div id="calculator19"> </div>
<div id="calculator20"> </div>
<div id="calculator21"><input type="text" name="text3" class="box3" readonly="readonly" value="" /> </div>
<div id="calculator22"> </div>
</form>
任何人都可以在这里帮助我......这真的让我发疯!