我在定价计算器中遇到了一些麻烦,更具体地说,试图在html输入字段中向用户显示结果。代码如下。通过html输入显示结果的价格计算器
<script type="text/javascript">
var quantity,result;
function setValues()
{
quantity = Number(document.getElementById("quantity").value);
}
function sum()
{
setValues();
result = ((quantity-25)*25)+3000;
if (result<3000)
{
result=3000;
}
document.getElementById("price").value = result;
}
</script>
<form class="pricing-form" action="pricing-mailer.php" method="post" name="pricing_quote" enctype="multipart/form-data">
<ul>
<li id="calculate">
<input type="button" onclick="sum()" value="sum" class="calculate">Calculate</button>
</li>
<li id="properties">
<label for="quantity" id="for_label"><strong>How many properties do you manage?</strong></label><br />
<input id="quantity" type="text"/>
</li>
<li id="price">
<label for="price" id="total_label"><strong>Your client accounting would cost just</strong></label><br />
<input id="price" type="text" value=""/>
</li>
</ul>
</form>
有什么问题吗..请说明一下你的问题.. –
'id ='price''已经使用过两次了 –