Need to create a questionnaire that prompts visitors to my web page for personal information, 4 questions. I need to assign each piece of info to an array then use a for loop to print the info on the screen.
This is what I have so far and it isn’t working:
<HTML>
<HEAD>
<TITLE>Questionnaire</TITLE>
<SCRIPT LANGUAGE=”JavaScript”>
<!– HIDE FROM INCOMPATIBLE BROWSERS
////////NEED TO ARRAY QUESTIONS AND ASSIGN ANSWERS TO AN ARRAY
var msg = new Array(5), i = 0;
for(i=0; i<5; i++)
var info = prompt(msg[i]);
document.writeln(info[0]);
for(i=0; i<msg.length; i++) ;
msg[0] = “What’s your name?”;
msg[1] = “What’s your address?”;
msg[2] = “What kind of job do you have?”;
msg[3] = “What is your favorite movie?”;
msg[4] = “What is your favorite activity?”;
//STOP HIDING FROM INCOMPATIBLE BROWSERS –>
</SCRIPT>
</HEAD>
<BODY>
<H1>Questionnaire</H1>
</BODY>
</HTML>