我正在学习JavaScript并正在开发一个JavaScript函数来根据买方的类型计算折扣,即零售商/批发商&如果是现金或支票付款。这是函数
<script>
function sell()
{
var gross,net,tax,discount,unitprice,quatity,select2,select3;
unitprice=parseInt(form9.unitprice.value);
quantity=parseInt(form9.quantity.value);
select3=parseInt(form9.select3.value);
select2=parseInt(form9.select2.value);
gross=parseInt(form9.gross.value);
gross=unitprice*quantity
form9.gross.value=gross;
tax=0.16*gross
form9.tax.value=tax;
if(select2='Cash' && select3='Retailer')
discount=0.07*gross;
else if(select2='Cash' && select3='Wholesaler')
discount=0.1*gross;
else if(select2='Check')
discount=0*gross;
form9.discount.value=discount;
net=(gross-(discount+tax));
form9.net.value=net;
}
</script>
我为买家类型创建了一个下拉菜单,命名为select2
<select name="select2">
<?php
do {
?>
<option value="<?php echo $row_rsCustomercategory['type']?>"><?php echo $row_rsCustomercategory['type']?></option>
<?php
} while ($row_rsCustomercategory = mysql_fetch_assoc($rsCustomercategory));
$rows = mysql_num_rows($rsCustomercategory);
if($rows > 0) {
mysql_data_seek($rsCustomercategory, 0);
$row_rsCustomercategory = mysql_fetch_assoc($rsCustomercategory);
}
?>
</select>
销售类型的选择菜单是select3
<select name="select3" id="select3">
<?php
do {
?>
<option value="<?php echo $row_rsSaletype['type']?>"><?php echo $row_rsSaletype['type']?></option>
<?php
} while ($row_rsSaletype = mysql_fetch_assoc($rsSaletype));
$rows = mysql_num_rows($rsSaletype);
if($rows > 0) {
mysql_data_seek($rsSaletype, 0);
$row_rsSaletype = mysql_fetch_assoc($rsSaletype);
}
?>
</select>
现金销售是7%零售商和10%批发商的折扣,没有折扣支票。
问题在于: 在浏览器中查看并单击&#34;计算&#34;按钮没有任何反应为什么是这样? 我将不胜感激任何帮助。