funkyspirit
Programmer
Hi there,
I am having an issue with a function and I can't get my head round it.
I have an asp/VBScript page our customers use to enter their data after choosing the product they want to buy, which displays the price of the package they chose.
I would like to enable them to enter a voucher code by selecting the code from a drop-down list and have the price recalculated according to the voucher code selected.
I was thinking of creating an onchange event on the drop-down list, which would pass the voucher code and the normal price to a JavaScript function to recalculate the price.
My problem is that the normal price is calculated by calling a VBScript function, named CalcPrice. CalcPrice takes two arguments, which are obtained from the previous page by using a Request() statement, as shown below:
CostPac = CalcPrice( Request("Pack"), Request("voucher"))
My question is how could I use the CostPac as a parameter alongside the voucher code when I call the JavaScript function to calculate the new price, in the onchange event of the drop down list.
The code I have tried for the drop-down list is below:
<div class="fieldbottommargin"></div>
<br />
<select class="SelectFields_voucher"onchange="calculateDiscount(this.options[selectedIndex].value,<%=CalcPrice( Request("Pack"),Request("voucher"))">
<option value="vch010">vch010</option>
</select>
But that, as I thought, does not work.
I hope this makes sense.
Any help would be greatly appreciated.
Thanks.
I am having an issue with a function and I can't get my head round it.
I have an asp/VBScript page our customers use to enter their data after choosing the product they want to buy, which displays the price of the package they chose.
I would like to enable them to enter a voucher code by selecting the code from a drop-down list and have the price recalculated according to the voucher code selected.
I was thinking of creating an onchange event on the drop-down list, which would pass the voucher code and the normal price to a JavaScript function to recalculate the price.
My problem is that the normal price is calculated by calling a VBScript function, named CalcPrice. CalcPrice takes two arguments, which are obtained from the previous page by using a Request() statement, as shown below:
CostPac = CalcPrice( Request("Pack"), Request("voucher"))
My question is how could I use the CostPac as a parameter alongside the voucher code when I call the JavaScript function to calculate the new price, in the onchange event of the drop down list.
The code I have tried for the drop-down list is below:
<div class="fieldbottommargin"></div>
<br />
<select class="SelectFields_voucher"onchange="calculateDiscount(this.options[selectedIndex].value,<%=CalcPrice( Request("Pack"),Request("voucher"))">
<option value="vch010">vch010</option>
</select>
But that, as I thought, does not work.
I hope this makes sense.
Any help would be greatly appreciated.
Thanks.