Close

Results 1 to 5 of 5
  1. #1
    DF Rookie g1bbo's Avatar
    Join Date
    Jan 2002
    Location
    UK
    Posts
    19
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Javascript problem....

    Hi all,

    I could really do with some help with a "small" javascript problem.

    Basically i am trying to write a simple shopping basket. I have got the adding of items and the updating of the totals working, however the problem is that i dont know how to remove the actual row in the table if the item total is ZERO.

    Any ideas?

    Ta
    G1bbo.

  2. #2
    DF VIP Member salvadorescobar's Avatar
    Join Date
    Dec 2000
    Location
    Huddersfield
    Posts
    951
    Thanks
    0
    Thanked:        0
    Karma Level
    345

    Default

    Not really sure what you are trying to do here?

    This problem does not really suit itself to JavaScript.

    Could you please give a little bit more detail as to what you are trying to do and I will try and help you.
    'If we aren't meant to eat animals, then why are they made out of meat?'
    Anon.

  3. #3
    DF Rookie g1bbo's Avatar
    Join Date
    Jan 2002
    Location
    UK
    Posts
    19
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Default

    Soz,

    well basically i have to use javascript to do stuff for a uni assignment and ive kinda hit a wall.

    Basically i am creating very basic shopping basket which adds items via the "document.write" command into a table.

    All i wos wondering is whether or not it is possible to remove the row created by the above command if a "remove" button is clicked?

    As of yet i dont have to code uploaded as im still tinkering with it. I know a server side system would be ideal but like i said at the minute i gotta use gud old js!

    thanks

  4. #4
    DF VIP Member salvadorescobar's Avatar
    Join Date
    Dec 2000
    Location
    Huddersfield
    Posts
    951
    Thanks
    0
    Thanked:        0
    Karma Level
    345

    Default

    OK, I think I get you.

    Firstly, no, you cannot direclty do a reverse of the document.write to remove a value from the table.

    Secondly is this site on only one page? as you will have to store your basket in some sort of form if it is going to be posted off at any point. Plus, what happens if you goto page 2 of the site. Where do the contents of the basket goto?

    What you could do is store an array of elements on the screen. If you set a limit on the size of your shopping basket you could output a table (using the document.write() methods.

    What you could do is trick the user into thinking parts of a table were appearing and disappearing using a <DIV style:visible=false> type of idea.
    If an entry in the shopping basket has a value of 0 then you hide the <DIV> thus making it look like the item has been removed. You would have some troube sorting them though.

    If you give more details I will have a better think about this.
    'If we aren't meant to eat animals, then why are they made out of meat?'
    Anon.

  5. #5
    DF VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    289

    Default

    you have a couple of choices...

    1. use a javascript array, and HTML Frames, to store the basket, the array would be in the top level frame, and the code to manipulate it would be in lower levels of frames. This is NOT a nice solution, but it relatively simple to implement.

    2. use cookies to store the basket, and manipulate them.

    3. use hidden form elements, and have an onsubmit event that will manipulate these hidden form elements, while outputting the updated form elements.

Similar Threads

  1. Floppy problem
    By urbsy in forum PC Problems
    Replies: 8
    Last Post: 7th September 2002, 12:04 AM
  2. F12002 Problem
    By shawtek in forum Microsoft Consoles
    Replies: 9
    Last Post: 31st August 2002, 10:20 AM
  3. Problem with Compaq Armada E500 Laptop
    By Mr Olympia in forum PC Problems
    Replies: 2
    Last Post: 29th August 2002, 02:40 PM
  4. real audio recording problem
    By flypitcher in forum Music Factory
    Replies: 3
    Last Post: 28th August 2002, 11:25 PM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •