Click to See Complete Forum and Search --> : Helppppppppppppppppp
MsTenacious
07-25-2003, 12:13 PM
I am so about to fail a quiz. Its not jsut me the whole class doesnt get this and he said we could use the net so its not cheating.
I have filled one array with prompt before but he wants us to fill 7 and I am stumped. I cna't even get the prompt box to come up! I think its because I am freaking.
This is what he gave us, there are 2 buttons and 2 functions, one to get the info and one to display it.
the prompt is supposed to ask you have many employees and then ask for first name last name ssi email hours worked and rate of pay.
when you click the second button you are supposed to display the first and last name the email and SSI and the total pay.
I have nothing and there is only 20 minutes left, HELP!!!
olerag
07-25-2003, 12:35 PM
One thing for sure - this isn't EN101 otherwise your sunk.
Before beginning, your not being very clear. I do not believe
your sure what your instructor's question is.
You mention (in the same breath) "seven arrrays", "some dialogs", "buttons", "functions", and a listing of six attributes:
first name,
last name,
ssan,
email,
hours worked,
rate of pay.
How are six attributes going to be contained in 7 arrays??
By the time you answer my question, your quiz will probably be over. But hey - when you get outta class, post the actual problem that your were given and lets see what some of the answers are.
This may not help you this time but maybe by the time your "final" comes up, you'll be better prepared.
Sorry - its Fri afternoon.
AdamBrill
07-25-2003, 12:42 PM
You might want something like this:<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
info=new Array();
function get_info(){
max_num=prompt("How many employees?","");
for(x=0; x<parseInt(max_num); x++){
info[x] = new Array();
info[x]['first_name']=prompt("First name:","");
info[x]['last_name']=prompt("Last name:","");
info[x]['ssi']=prompt("SSI:","");
info[x]['email']=prompt("E-mail:","");
info[x]['hours']=prompt("Hours Worked:","");
info[x]['rate']=prompt("Rate of Pay:","");
}
}
function write_info(){
data = "";
for(x=0; x<info.length; x++){
data += "Number "+x+":<br>";
data += "First Name: "+info[x]['first_name']+"<br>";
data += "Last Name: "+info[x]['last_name']+"<br>";
data += "SSI: "+info[x]['ssi']+"<br>";
data += "E-mail: "+info[x]['email']+"<br>";
data += "Hours Worked: "+info[x]['hours']+"<br>";
data += "Rate of Pay: "+info[x]['rate']+"<br><br>";
}
document.getElementById('write_info').innerHTML=data;
}
</script>
</head>
<body>
<input type=button value="Get Info" onclick="get_info();"><br>
<input type=button value="Write Info" onclick="write_info();">
<div id="write_info"></div>
</body>
</html>