Can't figure it for the life of me.

wxdqz

New Member
Hello,

I usually don't like to ask before I do the research but here I spent 2 days online trying to find an answer that I'm sure is right in front of my nose.

I have the following problem.

I am using a ASP page to generate the listing of products found. I have a "Add To Cart" button next to each listing in each row found. Right next to the button, I have a quantity field which allows to customer to enter how many do they want of the particular product. The way I am updating the shopping cart is using layers, so the page doesn't actually reload as it just updates the page on the layer. I named the HTML quantity field the name of the product id since I need to tell the javascript what field to use in order to see the quantity entered for the product being added. My problem is that it just doesn't want to pick up that field. Let me show you what I'm doing and maybe it will make a little more sense.


This is the HTML portion of the code that allows the customer to add to the shopping cart. Note that the value (461) is dynamic and changes based on the the results of the ASP page. This is just an example.

<input type="text" value=http://www.webdeveloper.com/forum/archive/index.php/"1" name="461" size="1" maxlength="50">&nbsp;<a href="javascript:addToCart('461');"><img border="0" src=http://www.webdeveloper.com/forum/archive/index.php/"./images/new/addtocart.gif"></a>

The follwing is the JavaScript portion of the code.

<script language="javascript">

function addToCart(item)
{
surl ='cart_action.asp?add=1&item_id='+item+'&qty=' + document[item.value];
content.document.location.replace(surl);
}
</script>

As you can see, I need to pass the quantity field to the cart_action.asp page as well. For some reason it is not passing that field plus it gives me error messages.

What am I doing wrong?

Thanks in advance for your help.
 
Back
Top