我有一个表单,在表单的“描述”字段中,我希望它从表单上的选项中详细说明产品价值和包装价值,这样当有人支付时,它会给我他们选择的选项....一切其他工作虽然现在已经很粗糙,但是我把功能线设置为变量描述并将其设置为+产品并将项目打包到一个字段中并在html中编码以将描述字段设置为该值但不是携带,有谁知道为什么?
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" language="javascript">
function calcTotal(form)
{
var totalElem = null;
var prodAmt = 0;
var packAmt = 0;
var printAmt = 0;
var designAmt = 0;
var totalAmt = 0;
var descrip = null;
{
prodAmt=parseFloat(form["prodamount"].value,2);
packAmt=parseFloat(form["packamount"].value,2);
printAmt=parseFloat(form["printOpt"].value,2);
designAmt=parseFloat(form["graphicOpt"].value,2);
totalAmt = parseFloat(prodAmt+packAmt+printAmt+designAmt,2);
totalElem=document.getElementById("amount");
totalElem.value = totalAmt.toString();
}
catch(e)
{
alert("calcTotal Error: " + e.Message);
}
finally
{
}
{
document.getElementById('descrip').innerText =
document.getElementById("Product: " +'prodamount').value + ', ' + "Pack: " +
document.getElementById('packamount').value;
}
}
</script>
</head>
<body>
<form id="orderform" name = "orderform" onchange="calcTotal(this)">
<input type="radio" name="prodamount" value="9.99"> product 1 <br/>
<input type="radio" name="prodamount" value="29.00" checked> product 2<br/>
<input type="radio" name="prodamount" value="49.00"> product 3
<hr/>
<input type="radio" name="packamount" value="99.00"> pack 1<br/>
<input type="radio" name="packamount" value="29.00"> pack 2<br/>
<input type="radio" name="packamount" value="0.00" checked> none<br/>
<!-- need to add in here a dropdown for selecting single or double side print (single stays same price but selecting double side adds £5 to the "amount" variable -->
<select id="printOpt" name="printOpt">
<option value="0">Single Sided Print</option>
<option value="5">Double Sided Print</option>
</select>
<br/>
<!-- another dropdown to select graphic design either 1 or 2 sides - 1 side adds £10 to total, 2 side add £15 to total -->
<select id="graphicOpt" name="graphicOpt">
<option value="0" selected>Supplying Own Artwork</option>
<option value="10">Single Sided Graphic Design</option>
<option value="15">Double Sided Graphic Design</option>
</select>
<br/>
<!-- box here displaying the total preferable without having to click a recalculate button -->
<br/><br/><br/><br/><br/><br/>
<input type="text" id="amount" name="amount" value="0"/>
<div id="totalAmt"></div>
<input type="text" id="description" name="description" value="0"/>
<div id="descrip"></div>
<input type="hidden" name="merchant_id" value="info@creaitve.co.uk"> <!-- nochex required -->
<input type="hidden" name="business" value="info@creaitve.co.uk"> <!-- paypal required -->
<input type="hidden" name="currency_code" value="GBP"> <!-- paypal required -->
<input type="hidden" name="cmd" value="_xclick"> <!-- paypal required -->
<input name="instId" type="hidden" value="1243833" /> <!-- worldpay required -->
<input type="hidden" name="currency" value="GBP"> <!-- worldpay required -->
<input type="hidden" name="cartId" value="CreaITve"> <!-- worldpay cart name -->
<input type="hidden" name="description" value="CreaITve"> <!-- nochex cart name -->
<input type="hidden" name="item_name" value="CreaITve"> <!-- paypal cart name -->
<input type="hidden" name="desc" value="Print Service A7 Leaflets" + printOpt> <!-- worldpay product name -->
<!-- <input type="hidden" name="description" value="Print Service A7 Leaflets" + printOpt> nochex product name -->
<input type="hidden" name="item_name" value="Print Service A7 Leaflets" + printOpt> <!-- paypal product name -->
<input type='submit' name='worldpay' value='WorldPay' formAction="https://secure.worldpay.com/wcc/purchase" method="POST"><autocomplete="off" onsubmit="return verifyfields()">
<input type='submit' name='nochex' value='NoChex' formAction="https://secure.nochex.com/"><autocomplete="off" onsubmit="return verifyfields()">
<input type='submit' name='paypal' value='Paypal' formAction="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
</form>
<script type="text/javascript" language="javascript">
// Calculate the initial total
calcTotal(document.getElementById("orderform"));
</script>
</body>
</html>