PDA

View Full Version : Help Needed



ir_robin
01 Oct 2007, 06:12 PM
Okay I am trying to make two buttons for a paypal shopping cart, that require javascript i made the code but i cant seem to figure out what is wrong, i know it is something to do with the form names but i don't know how to name them so the first button is recognized and the second was is recognized individual here is the script.

<script language="javascript">

function calculateorder(forma)
{

if (forma.os0.value == "Bag of 100")
{
forma.amount.value = 1.00;
forma.item_name.value = "Item 1";
}

if (forma.os0.value == "Bag of 250")
{
forma.amount.value = 2.00;
forma.item_name.value = "Item 1";
}

if (forma.os0.value == "Bag of 500")
{
forma.amount.value = 3.00;
forma.item_name.value = "Item 1";
}

}//end of functions

</script>


<div>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" name="form">

<table style="width: 279px">
<tr>
<td>
<input type="hidden" name="on1" value="Size">Select Size:
</td>
<td width="112">

<select name="os1">
<option value=".377">.377
<option value=".378">.378
<option value=".379">.379
<option value=".380">.380
</select>

</td>
</tr>

<tr>
<td>
<input type="hidden" name="on0" value="Quantity">Select Quantity:
</td>
<td width="112">

<select name="os0">
<option value="Bag of 100">Bag of 100
<option value="Bag of 250">Bag of 250
<option value="Bag of 500">Bag of 500
</select>

</td>
</tr>
</table>

<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_SM.gif" border="0" name="submit" onClick="calculateorder(forma)"

alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="jgowdyiraq@yahoo.com">
<input type="hidden" name="item_name" value="Item 1">
<input type="hidden" name="amount" value="1.00">
<input type=hidden name=handling_cart value="8.95">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shopping_url" value="http://www.grandmasterbullets.com/Shop%20Online.htm">
</form>




<script language="javascript">

function calculateorder(formb)
{

if (formb.os0.value == "Bag of 100")
{
formb.amount.value = 4.00;
formb.item_name.value = "Item 2";
}

if (formb.os0.value == "Bag of 250")
{
formb.amount.value = 5.00;
formb.item_name.value = "Item 2";
}

if (formb.os0.value == "Bag of 500")
{
formb.amount.value = 6.00;
formb.item_name.value = "Item 2";
}

}//end of functions

</script>


<div>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" name="form">

<table style="width: 279px">
<tr>
<td>
<input type="hidden" name="on1" value="Size">Select Size:
</td>
<td width="112">

<select name="os1">
<option value=".377">.377
<option value=".378">.378
<option value=".379">.379
<option value=".380">.380
</select>

</td>
</tr>

<tr>
<td>
<input type="hidden" name="on0" value="Quantity">Select Quantity:
</td>
<td width="112">

<select name="os0">
<option value="Bag of 100">Bag of 100
<option value="Bag of 250">Bag of 250
<option value="Bag of 500">Bag of 500
</select>

</td>
</tr>
</table>

<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_SM.gif" border="0" name="submit" onClick="calculateorder(formb)"

alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="jgowdyiraq@yahoo.com">
<input type="hidden" name="item_name" value="Item 2">
<input type="hidden" name="amount" value="1.00">
<input type=hidden name=handling_cart value="8.95">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shopping_url" value="http://www.grandmasterbullets.com/Shop%20Online.htm">
</form>