473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Shopping cart problems: popup window blank, products being replaced

8
i am creating a shopping cart for a project..

i have come across few problems where i couldn't find a satisfiable solution .

the problem in detail;;

1. in this web site there are several pages , that contains products. and when a user clicks on a product (clicks on a checkbox) the product should go to a shopping cart which is on another page or a pop up window.

2. when i select the checkbox , the present window gets updated with the product details, and the pop up window open seperately (but blank .. no items are displayed there)

3. and when i go to another page and click on a product the products i have alreadychosen gets replaced, by the new products.

i no this is not a good thing to do (i mean asking for help) , but i have tried all, to get this thing work.

i will enclose my javascript code could you be great enough to check it and tell me where i went wrong ...

code::::::::::::::;


Expand|Select|Wrap|Line Numbers
  1. var store= new Array();
  2.  
  3.     store[0]="these  are just data"; // the data are stored in these arrays
  4.     store[1]="jau";
  5.     store[2]="s";
  6.     store[3]="jr";
  7.     store[4]="shiiii";
  8.     store[5]="jpoler";   
  9.     store[6]="hhddfl";
  10.     store[7]="jmaddddddder";
  11. function testButton (form){
  12.  window.open ("pl.html","mywindow","menubar=1,resizable=1,width=350,height=250");
  13. window.write ("<table border = \"1\"" + "width = \"100\">");
  14.        window.write ("<thread> <th width = \"100\"" + "align = \"left\"> Count<th align = \"left\">" + "Frequency</th></thread><tbody>");
  15.  
  16.     for (var sha = 0;sha < 100; sha++) {
  17.  
  18.         if (form.rad[sha].checked)
  19.         {                    // the array is called so the data is displayed
  20.             //store=sha;
  21.            window.write ("<tr><td>" + store[sha] +"</td><td>"+ sha + "</td></tr>");
  22.         }
  23.     }
  24.     window.write ("</tbody</table>>");
  25. }
  26.  
and this is how i call the product from a submit button ( or even from the check box)
[html]
<input type="button" value="hi" onClick="document.testform.submit();testButton(thi s.form)"/>
[/html]
plzzzz help................

and plzzz reply as soon as posible

regards
Jun 10 '08 #1
6 1741
acoder
16,027 Expert Mod 8TB
You have a number of problems with your code.

You're submitting the form and then trying to open a popup.

Secondly, you're not using window.open() properly. See this link.

Thirdly, look at the proper HTML to use for a table.

Also window.write should be replaced by win.document.write where win is a reference to the window. You're already opening a file and then trying to write to it. That will also cause problems.
Jun 10 '08 #2
localp
8
what should i do.. i went through the link u gave ... but i am still having problems ..

can u plzzzzzzzzzzzzzz tell me where it went wrong .. and a posible solution for it (i mean the code)

how should i open the pop up window 1st ( i actually got it from a site )

i am kind of lost

plzz help me
Jun 10 '08 #3
localp
8
You have a number of problems with your code.

You're submitting the form and then trying to open a popup.

Secondly, you're not using window.open() properly. See this link.

Thirdly, look at the proper HTML to use for a table.

Also window.write should be replaced by win.document.write where win is a reference to the window. You're already opening a file and then trying to write to it. That will also cause problems.
what should i do.. i went through the link u gave ... but i am still having problems ..

can u plzzzzzzzzzzzzzz tell me where it went wrong .. and a posible solution for it (i mean the code)

how should i open the pop up window 1st ( i actually got it from a site )

i am kind of lost

plzz help me
Jun 10 '08 #4
localp
8
this is the javascript file ::: i have done some modifications here ... if i remove the comment below i will get a lot of popup windows open .. i want to avoid it . and make the content display on it ..


for the once who is not getting what i'm trying to do -

i am trying to create a shopping cart application here using javascript ..
when the user clicks on the purchaise button the details should be submitted to the cart. and thats why i am using a pop up window.


there is another problem, when i select an item from one page it gets displayed, then when i go to another page and select another item, the items that i selected in the 2nd page replaces the items in the 1 st page .. it simply does not get appended .. so i want a solution for this also ...


can some one please alter the code for me .. i am completely lost on this ..

plus i'm new to this forum thus i have posted 2 questions (both similar kind of ques)

Expand|Select|Wrap|Line Numbers
  1. var royal= new Array();
  2. var store= new Array();
  3. var stu= new Array();
  4.  
  5. var t;
  6.     store[0]="shamil";
  7.     store[1]="jauffer";
  8.     store[2]="s";
  9.     store[3]="jr";
  10.     store[4]="shiiii";
  11.     store[5]="jpoler";    
  12.     store[6]="hhddfl";
  13.     store[7]="jmaddddddder";
  14.     stu[0]="jill";
  15.     stu[1]="j";
  16.     stu[2]="welle";
  17.     stu[3]="mal";        
  18.  
  19. function testButton (form){
  20. //window.open("pl.html");
  21. var s= win.document.write("<table border = \"1\"" + "width = \"100\">");
  22.  var y=    win.document.write   ("<thread> <th width = \"100\"" + "align = \"left\"> Count<th align = \"left\">" + "Frequency</th></thread><tbody>");
  23.  
  24.     for (var sha = 0;sha < 100; sha++) {
  25.  
  26.         if (form.rad[sha].checked)
  27.         {
  28.             //store=sha;
  29.             royal[sha]=store[sha]
  30.          t=  win.document.write("<tr><td>" + royal[sha] +"</td><td>"+ royal[sha] + "</td></tr>");
  31.         }
  32.  
  33.     }
  34.     win.document.write("</tbody></table>");
  35.   win.document.write("<h1> hfhhfhdf " + s  + y + + t +"</h1>");
  36.  
  37.  
  38.  
  39. }


plzzzzzzzzzzz help me .. i'm lost
Jun 10 '08 #5
acoder
16,027 Expert Mod 8TB
plus i'm new to this forum thus i have posted 2 questions (both similar kind of ques)
Which is why I've now merged the threads. Please do not double-post your questions. Keeping to one thread makes it easier to answer.

Welcome to Bytes! Since you're new, have a quick look at the posting guidelines. One of these is that code is posted in code tags. Thanks!
Jun 11 '08 #6
acoder
16,027 Expert Mod 8TB
Let's try and deal with the problems one at a time.

When using window.open() to open a blank file to write to, use something like this:
Expand|Select|Wrap|Line Numbers
  1. function testButton (form){
  2. var win = window.open('','someName');
  3. win.document.write("<table border = '1' width = '100'>");
  4.  
There's no 'thread' tag unless you meant a thead tag. Does that make an improvement?
Jun 11 '08 #7

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

Similar topics

3
by: Phil Powell | last post by:
I need a back-to-basics shopping cart tutorial in PHP/mySQL. I thought I had it down and I failed, as usual. Here is what I mapped out as a spec: 3) initial work on bestilling.php to contain the...
1
by: Alex Ivascu | last post by:
Hi; I am no PHP programmer, unfortunately. So your assistance is appreciated. I am starting to look into using the Agora Shopping cart. There is a page in there called productPage.inc and I...
9
by: Penny | last post by:
Hi all, I've built an online shopping cart using ASP Classic(based on a 'WebThang' tutorial). The shop cart page (with table showing customers selected items and costs) has only 3 buttons/links....
2
by: Mark Hannon | last post by:
I am designing a PayPal shopping cart/store for a client and have placed several of PayPal's shopping cart forms on the page to correspond with different products. Each form has a unique name...
1
by: Adil Akram | last post by:
I have created a site shopping cart in ASP.net. I am using ASP session object's SessionID on non SSL connection to track session. While adding products to cart DB I insert product and SessionID...
2
by: Guadala Harry | last post by:
I'm looking to implement some *minimal* shopping cart. I've looked at a few 3rd party packages, and they're all way too involved for what I need. So, I'm thinking it might make sense to roll my...
2
by: G.E.M.P | last post by:
High Level Session Handling Design for a Shopping cart 0) What am I missing? 1) How does OSCommerce do it? I'm thinking about building a shopping cart from scratch, using a library of dynamic...
4
ak1dnar
by: ak1dnar | last post by:
Hi, I am Building small shopping cart that enables customers to select books from the list and Add it to the Cart. When i click Add Button the Cart Should Update with these things. No of...
1
by: Infused | last post by:
Here is the problem I need a solution to. I do not have much experience in dealing with shopping carts I've setup a few but nothing this elaborate. I have a client that is dealing with multiple...
1
by: ljenner | last post by:
Hi everyone, This is probably a very easy question: I have a shopping cart table and two products tables (legacy reasons...). I need to create a relationship between the ShoppingCart table...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.