469,356 Members | 2,460 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Shopping cart -fly to basket in asp.net and dhtml

hi all. now i m creating shopping cart. i would like to make when the user click the add to basket button, item added visually shown to user. i found one script for this in net.. but i couldnt pass dynamic productid to that addtobasket javascript function.
this is my function..
function addToBasket(productId)
if(!shopping_cart_div)shopping_cart_div = document.getElementById('shopping_cart');
flyingDiv = document.createElement('DIV');
flyingDiv.style.position = 'absolute';

shopping_cart_x = shoppingCart_getLeftPos(shopping_cart_div);
shopping_cart_y = shoppingCart_getTopPos(shopping_cart_div);

currentProductDiv = document.getElementById('slidingProduct' + productId);

currentXPos = shoppingCart_getLeftPos(currentProductDiv);
currentYPos = shoppingCart_getTopPos(currentProductDiv);

diffX = shopping_cart_x - currentXPos;
diffY = shopping_cart_y - currentYPos;

var shoppingContentCopy = currentProductDiv.cloneNode(true);
flyingDiv.innerHTML = '';
flyingDiv.style.left = currentXPos + 'px';
flyingDiv.style.top = currentYPos + 'px';
flyingDiv.style.width = currentProductDiv.offsetWidth + 'px';

this is my asp.net code

<asp:DataList ID="dlstProductDetails" runat="server" RepeatDirection="Horizontal" RepeatColumns="3" HorizontalAlign="Center" style="text-align: center" Width="100%" SkinID="DataList" >
<div id="slidingProduct+dynamicvalue" class="sliding_product"><asp:ImageButton ID="imgbtnProductImage" runat="server" ImageUrl='<%#"images.aspx?id=" + Eval("ProductNo")%>' Height="100" Width="100" Commandname='<%#DataBinder.Eval(Container.DataItem , "ProductNo")%>' OnCommand="Filterdescription"/>
<asp:Label ID="lblProductName" runat ="server" Text ='<%#DataBinder.Eval(Container.DataItem, "Productname")%>'></asp:Label>
<asp:Label ID="lblHyp" runat="server" text=" - " ForeColor="#ff8000"/>
<asp:Label ID="lblModelNo" runat ="server" Text ='<%#DataBinder.Eval(Container.DataItem, "ModelNo")%>'></asp:Label>
<br />
<asp:Label ID="lblrs" runat="server" text="RS." ForeColor="#ff8000"/>
<asp:Label ID="lblPrice" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SalesPrice")%>' ForeColor="#ff8000" ></asp:Label>
<asp:Label ID="Label1" runat ="server" Text ='<%#DataBinder.Eval(Container.DataItem, "ProductNo")%>'></asp:Label>

<br />
<a href="#" onclick="addToBasket(productno);return false;"><img src="images/basket.gif"></a>


just see those functions. i need to pass dynamic value to addtobasket method and div id.
any one have any idea... pls modify this code for my requirement... thanks...
Dec 17 '07 #1
0 1634

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Don Grover | last post: by
1 post views Thread by madison | last post: by
1 post views Thread by Jia Sun | last post: by
1 post views Thread by Adil Akram | last post: by
2 posts views Thread by G.E.M.P | last post: by
1 post views Thread by jecha | last post: by
3 posts views Thread by Paulo | last post: by
6 posts views Thread by frank | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.