View Single Post
  #1  
Old 10-17-2004, 09:04 PM
 
Local Hero Local Hero is offline
 

Senior Member
  
Join Date: May 2004
Location: UT
Posts: 121
 

Default NEED JAVASCRIPT HELP PLZ!!

Hey, I'm having a bit of a problem with JavaScript and X-Cart on a static page. I'm trying to make it so when the user selects the color of an item from a dropdown box, it changes the image to the appropriate color AND keeps the value of the dropdown box so the user can see which one he chose when viewing the cart contents. If you need to know I'm on Xcart version 3.5.6. I have the image swapping working, but I can't get the value of the textbox to transfer to the cart. Is it because of the brackets [] ?


Any help is greatly appreciated! THANK YOU!

Here's the page:http://www.localheroclothing.com/staticlongsleeve.html

Here's my code:

<html><head>

<title>Local Hero Clothing</title>

<link rel="stylesheet" href="herostyle.css" type="text/css">

<Script Language=Javascript>

function showcolor()
{
var varcolorcode=document.orderform_16134.color.option s[document.orderform_16134.color.selectedIndex].value;
var imgname="cc_" + varcolorcode + ".jpg";
document.images["colorcodeurl"].src=imgname;
document.images["enlargepic"].src="/images/enlarge.gif";
}

function loadstring()
{
var colorvalue=document.orderform_16134.color.options[document.orderform_16134.color.selectedIndex].value;
}
</SCRIPT>


</head>

<body>



<tr><td>

<form name="orderform_16134" method=post action="http://www.localheroclothing.com/store/customer/cart.php">
<input type=hidden name=mode value=add>
<input type=hidden name=productid value="16134">


<tr>

<!--<td nowrap valign="middle" rowspan="2" align="center">
[img]images/1x1t.gif[/img]-->

</td>
</tr>
<tr>
<td nowrap><font face="Arial" size="2" color="white">Select Color</font></td><td>
<select size="1" name="color" onChange="showcolor(); document.orderform_16134.product_options[color].value=document.orderform_16134.color.options[document.orderform_16134.color.selectedIndex].value;">
<option SELECTED value="yellowblock">Yellow</option><option value="redblock">Red</option>
</select><font size="1"></font></td>

</tr>






<tr>
<td height=25>
<font color="white">Size
</td>
<td >
<select name="product_options[Size]">
<option value=0>S</option>
<option value=1>M</option>
<option value=2>L</option>
<option value=3>XL</option>
</select>
</td>
</tr>


<tr><td height=25 width=30%><font color="white">Quantity</td>
<td>
<input type=hidden name=amount value="1">

<select name=amount>

<option value="1" >1</option>
select>
</select>

<input type=hidden name="product_options[color]" value="">
</td></tr>

<tr>
<td nowrap valign="middle" rowspan="2" align="center">
[img]images/1x1t.gif[/img]
</td></tr>

<tr><td colspan=1><center>

<font class=FormButton>Add to cart </font>http://www.localheroclothing.com/store/skin1/images/GOboutonWhiteBkg.gif

</td></tr>
</table>
</body>
</html>
__________________
X-Cart version 4.4.5
X-Cart version 5.3.2.8
Reply With Quote