dailce Posted February 22, 2005 Share Posted February 22, 2005 Hello I have the following javascript inserted between the "head" of my PHP page. It is used to change and calculate the tax on an order. <script language="javascript"> <!-- var taxp = 0; // tax percent for this order function Process (obj1) { // process the form, but no submit var i,j,bamt,ttax; bqty = obj1.quantity.value; // selected quantity bqty = bqty*1.0; //float that sucker bamt = obj1.amount.value * 1.0; //get amount var ttax = taxp/100.0; // yep - calculate it. var unformatted_tax = ttax * bamt; var format_tax = fmtPrice(unformatted_tax); obj1.tax.value = format_tax; } function fmtPrice(value) { var result = Math.floor(value)+"."; var cents = 100*(value-Math.floor(value))+0.5; result += Math.floor(cents/10); result += Math.floor(cents%10); return result; } function SetTX (obj1) { // Set tax percent for this order var pos; pos = obj1.selectedIndex; // which item selected taxp = obj1.options[pos].value*1.0; // float it } //--></script> This is my BUY now button code: <FORM name = "paypal" action="https://www.paypal.com/cgi-bin/webscr/" method="post" onsubmit = "return Process (this);"> <p> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="[email protected]"> <input type="hidden" name="item_name" value="XXXXXXXX"> <input type="hidden" name="item_number" value="XXXXXXXX"> <input type="hidden" name="amount" value="79.99"> <input type="hidden" name="shipping" value="8.00"> <INPUT TYPE="hidden" NAME="tax" VALUE="0"> <input type="hidden" name="return" value="http://www.XXXXX.ca/orderpass.htm"> <input type="hidden" name="cancel_return" value="http://www.XXXXX.ca/orderfail.htm"> <input type="hidden" name="currency_code" value="USD"> </p> <p class="main"><b><font color="FF0000">Select Shipping Location:</font></b> <select name= "taxer" id = "taxer" onchange = "SetTX (this);"> <option value="0" selected>U.S.A or International</option> <option value="15">Ontario (15% GST/PST)</option> <option value="7">Other Canada (7% GST)</option> <option value="15">NL, NS, NB (15% HST)</option> </select> </p> <p> <input name="submit" type="image" src="images/x-click-but23ccc.gif" alt="Make payments with PayPal - it's fast, free and secure!" width="101" height="35" border="0"> </p> </form> Baiscally I am trying to create a quick way for the buyer to buy one product. Whenever I click on the buy now button nothing happens it just jumps to the shopping cart page. Also, what code could I use to append the shopping cart items to the item name aboove? Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.