【发布时间】:2010-04-05 22:53:54
【问题描述】:
我有两个字段需要相乘并填写第三个表单的值。这是 HTML:
<input type="text" name="estimate[concrete][price]" value="" onBlur="calc_concreteprice(document.forms.mainform);" />
per SF <strong>times</strong>
<input type="text" name="estimate[concrete][sqft]" value="" onBlur="calc_concreteprice(document.forms.mainform);" /> SF
= <input type="text" name="estimate[concrete][quick_total]" value="" />
这是我的 JavaScript:
function calc_concreteprice(mainform) {
var oprice;
var ototal;
oprice = ((mainform.estimate[concrete][sqft].value) * (mainform.estimate[concrete][price].value));
ototal = (oprice);
mainform.estimate[concrete][quick_total].value = ototal;
}
我希望将前两种形式相乘并输出到第三种形式。我认为我的问题可能在于我如何使用括号引用输入字段名称(我将此表单的结果作为数组获取,因此我已经习惯将结果作为多维数组处理)。
【问题讨论】:
标签: javascript html object