Hello,
I have this ecom page that i am making where customers can select to choose
additional licenses before they purchase. I have that part working with
javascript.
Problem is that when the selection is made and you hit the add but it isn't
sending to the right pages (and i think i need to do it in another statemen
instead of a if..then, since there will be at least 16 conditions here.
<%
Response.Expire s = -1000
Response.Buffer = True
If Request.Form("p urchase") ="true" Then
BuyCrossSale
Else
CrossSale
End If
Sub BuyCrossSale
Dim prod2, prod3, one, two, three, tons
one = "1"
two= "2"
three = "3"
tons = "99"
prod2 = Request.Form("p rod2")
prod3 = Request.Form("p rod3")
If Request.Form("l icenses") = one AND prod2 = "on" AND prod3 = "on" Then
Response.Redire ct "http://www.msn.com"
Else
If Request.Form("l icenses") = one AND prod3 = "on" Then
Response.Redire ct "http://www.dogpile.com "
Else
If Request.Form("l icenses") = one AND prod2 = "on" Then
Response.Redire ct "http://www.google.com"
Else
If Request.Form("l icenses") = one Then
Response.Redire ct "http://www.google.com"
Else
Response.Redire ct "http://ps2.ign.com"
CrossSale
End If
End If
End If
End If
End Sub
%>
<script language="JavaS cript" type="text/JavaScript">
<!--
function MM_preloadImage s() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0; i<a.length;
i++)
if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function UpdateTotal()
{
var product_name = "MAIN";
var regular = 0;
var saved = 0;
var total = 0;
var Ptotal = 0;
var Pregular = 0;
if(document.get ElementById('fr m').licenses.va lue == 1)
{
total += 19.99;
regular += 19.99 * 2;
}
else if(document.get ElementById('fr m').licenses.va lue == 2)
{
product_name = "MAIN x 2";
total += 29.99;
regular += 19.99 * 2 * 2;
}
else if(document.get ElementById('fr m').licenses.va lue == 3)
{
product_name = "MAIN x 3";
total += 39.99;
regular += 19.99 * 2 * 3;
}
else if(document.get ElementById('fr m').licenses.va lue == 99)
{
product_name = "MAIN Unlimited";
total += 69.99;
regular += 19.99 * 2 * 4;
}
Ptotal = total;
Pregular = regular;
if(document.get ElementById('fr m').prod2.check ed)
{
document.getEle mentById("row_a p").style.displ ay = '';
total += 9.99;
regular += 9.99;
}
else
{
document.getEle mentById("row_a p").style.displ ay = 'none';
}
if(document.get ElementById('fr m').prod3.check ed)
{
document.getEle mentById("row_a a").style.displ ay = '';
total += 6.99;
regular += 39.99;
}
else
{
document.getEle mentById("row_a a").style.displ ay = 'none';
}
saved = regular - total;
if(document.all ) //ie
{
document.all("p roduct_name").i nnerText = product_name;
document.all("p roduct_price"). innerHTML =
formatAsMoney(P total).toString () + " <font size='1' color='#ffffff'
face='Verdana'> <b>(<s>" + formatAsMoney(P regular).toStri ng() +
"</s>)</b></font>";
document.all("t otal_purchase") .innerText = '$' +
formatAsMoney(t otal).toString( );
}
else
{
document.getEle mentById("produ ct_name").textC ontent = product_name;
document.getEle mentById("produ ct_price").inne rHTML =
formatAsMoney(P total).toString () + " <font size='1' color='#ffffff'
face='Verdana'> <b>(<s>" + formatAsMoney(P regular).toStri ng() +
"</s>)</b></font>";
document.getEle mentById("total _purchase").tex tContent = '$' +
formatAsMoney(t otal).toString( );
}
return true;
}
function formatAsMoney(m nt)
{
mnt -= 0;
mnt = (Math.round(mnt *100))/100;
return (mnt == Math.floor(mnt) ) ? mnt + '.00'
: ( (mnt*10 == Math.floor(mnt* 10)) ?
mnt + '0' : mnt);
}
//-->
</script>
</head>
<body><% Sub CrossSale %>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<th scope="col"</th>
</tr>
<tr>
<td><table width="750" border="1" align="center" cellpadding="0"
cellspacing="0" bordercolor="#0 00000" class="bground" >
<tr>
<th><table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th<form method="post" action="work.as p" target="_top"
name="frm" id="frm">
<input type="hidden" name="purchase" value="true">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th width="243" valign="top" align="center">
<table width="100%" border="0" align="center" cellpadding="0"
cellspacing="0" >
<tr>
<td><table width="95%" border="0"
align="center" cellpadding="0" cellspacing="0" >
<tr>
<td align="center" class="product" >Your
Current Order:</td>
</tr>
<tr>
<td><table width="95%" border="2"
align="center" cellpadding="1" cellspacing="2" bgcolor="#00336 4" class="para">
<!--DWLayoutTable-->
<tr>
<td width="113" align="left"
class="parabold white" id="product_nam e">MAIN</td>
<td width="104" align="right"
class="parabold white" id="product_pri ce">19.99 <span
class="parabold white2">(<s>39. 99</s>)</span></td>
</tr>
<tr id="row_ap">
<td align="left"
class="parabold white">PRODUCT 2 </td>
<td align="right"
class="parabold white"><b>9.99 <span
class="parabold white2">(<s>19. 99</s>)</span></td>
</tr>
<tr id="row_aa">
<td align="left"
class="parabold white">PRODUCT 3 </td>
<td align="right"
class="parabold white">6.99 <span
class="parabold white2">(<s>9.9 9</s>)</span></td>
</tr>
<tr>
<td style="padding: 0px;" colspan="2"
valign="top"></td>
</tr>
<tr>
<td align="left"
class="parabold red">Your Total:</td>
<td align="right"
class="parabold red" id="total_purch ase">$36.97</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></th>
<th width="457" valign="top"<ta ble width="100%"
border="0" cellpadding="0" cellspacing="0" id="AutoNumber2 " class="para">
<tr>
<td colspan="2"><di v align="center">
<select name="licenses" id="licenses"
onChange="retur n UpdateTotal();" >
<option value="1">Singl e Computer
$19.99</option>
<option value="2">2 Computers $29.99</option>
<option value="3">3 Computers $39.99</option>
<option value="99">Unli mited Computer
License $69.99</option>
</select>
</div></td>
</tr>
<tr>
<td colspan="2"</td>
</tr>
<tr>
<td colspan="2" align="left" class="para"><b r>
<input name="prod2" type="checkbox" id="prod2"
onClick="return UpdateTotal();" value="ON" checked="CHECKE D" />
Yes, Include PRODUCT 2<br>
<input name="prod3" type="checkbox" id="prod3" onClick="return
UpdateTotal();" value="ON" checked="CHECKE D" />
Yes, Include PRODUCT 3</td>
</tr>
<tr>
<td align="left" valign="top"</td>
<td align="left" class="para"><b r>
<br>
<a value="Add" name="yes" type="submit">
<input type="submit" value="Add" name="yes">
</a></td>
</tr>
</table>
</th>
</tr>
</table>
</form>
</th>
</tr>
<tr>
<td valign="top" align="center" class="footer"</td>
</tr>
</table></th>
</tr>
</table></td>
</tr>
<tr>
<td</td>
</tr>
</table><% End Sub %>
Any help is greatly appreciated :)