Show results of multiple prompt boxes using Javascript [closed]

Sequentially

if you are talking about the almost obsolete native javascrtipt function prompt() then:

var array=[];questions=['A?','B?','C?'],current=0;
function q(question){
 array.push(prompt(question,'write here')+' question number:'+current);
 if(current<questions.length){
  next()
 }else{
  array.sort()// needs a proper sort function
  alert(array.join("\n"));
 };
}
function next(){
 q(questions[current++]);
}
next();

Demo

http://jsfiddle.net/c7GnX/

Leave a Comment