ComputerWolf
08-25-2003, 06:35 PM
Whenever i try and use this script it says 'state' is null or not and object. 'state' is the option that the user is selecting, which changes the value of shipping depending on state. Can anyone tell me what is wrong. Thanks.
<html>
<head>
<script language="JavaScript">
function getshipping(obj1)
{
var cstate=obj1.state.value;
if (cstate="AK")
{
obj1.shipping.value=5.00;
}
else
{
obj1.shipping.value=6.00;
}
}
</script>
</head>
<body>
<form name=mahyd target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" onSubmit="getshipping(this.form);">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="laura@laurascustomfloral.com">
<input type="hidden" name="item_name" value="Magnolia and Hydrangea Centerpiece">
<input type="hidden" name="item_number" value="AR1">
<input type="hidden" name="amount" value="69.95">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shipping" value="">
<table><tr><td>State</td><td><select name="state"><option value=AL>Alabama<option value="AK">Alaska</select>
</td></tr></table><input type="image" src="https://www.paypal.com/images/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="add" value="1">
</form>
<html>
<head>
<script language="JavaScript">
function getshipping(obj1)
{
var cstate=obj1.state.value;
if (cstate="AK")
{
obj1.shipping.value=5.00;
}
else
{
obj1.shipping.value=6.00;
}
}
</script>
</head>
<body>
<form name=mahyd target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" onSubmit="getshipping(this.form);">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="laura@laurascustomfloral.com">
<input type="hidden" name="item_name" value="Magnolia and Hydrangea Centerpiece">
<input type="hidden" name="item_number" value="AR1">
<input type="hidden" name="amount" value="69.95">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shipping" value="">
<table><tr><td>State</td><td><select name="state"><option value=AL>Alabama<option value="AK">Alaska</select>
</td></tr></table><input type="image" src="https://www.paypal.com/images/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="add" value="1">
</form>