Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Gez
    Gez is offline
    New Coder
    Join Date
    May 2008
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts

    data from users using only prompt

    I have a array know as 'catalogue' , this is basically a catalogue of books containing some infomation about them (ISBN, price etc.). My task is to allow as user(who has seen the catalogue elsewhere) to enter the ISBN & Quantity using only the prompt feature of js. Now the user may want one book or many, all the data will be stored in a new array called 'order' in the format ['ISBN:quantity','.....]; now as im very new to js i really have no idea how to do this so all help will be greatly appreciated, thanks
    Gez

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    For and intro about prompt() in javascript, see http://www.w3schools.com/HTMLDOM/met_win_prompt.asp
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Gez
    Gez is offline
    New Coder
    Join Date
    May 2008
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts
    I know how to do prompts, i just don't know how to include it in a loop so that i can get for example several variables out of it depending on how many books the user wants.
    Gez

  • #4
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    Here is a vary basic loop that would do something at least similar to what you need
    Code:
    books = [books user wants/ your books];
    question = [ prompt questions ];
    for(i=0; i<books.length; i++){
         prompt(question[i]);// prompts the needed question or phrase or book info depending
    }


  •  

    Posting Permissions

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