View Full Version : data from users using only prompt

08-08-2008, 04:56 PM
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

08-08-2008, 05:08 PM
For and intro about prompt() in javascript, see http://www.w3schools.com/HTMLDOM/met_win_prompt.asp

08-08-2008, 05:18 PM
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.

08-08-2008, 06:56 PM
Here is a vary basic loop that would do something at least similar to what you need

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