DerekAcorah
06-12-2007, 05:24 PM
Hi people!
Im new to Javascript and need a bit of help. OK, ive got a program, but when it prompts me to enter the 5 numbers, it says every day of the week, i now need it so that on the first prompt its monday, 2nd prompt tuesday etc etc,
Can anyone point me in the right direction (i don't want the answer, i just need some direction because im clueless!) Please help!
<HTML>
<HEAD>
<TITLE> Number of library books borrowed
</TITLE>
<SCRIPT >
/* Program to read in a known number of data items and store them in an array */
var booksArray = new Array (5);
var dayNamesArray = ['Monday','Tuesday','Wednesday','Thursday','Friday'];
document.write('Array program to read in a known number of data items');
for (var day = 0; day < booksArray.length; day = day + 1)
{
booksArray[day] = window.prompt('Enter number of books borrowed on ' + (dayNamesArray + 1),'')
};
document.write('<BR>' + '<BR>');
document.write('Confirmation of number of books borrowed' + '<BR>' + '<BR>');
for (var day = 0; day < booksArray.length; day = day + 1)
{
document.write(dayNamesArray[day] + ' : ' + booksArray[day] + '<BR>')
}
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
Im new to Javascript and need a bit of help. OK, ive got a program, but when it prompts me to enter the 5 numbers, it says every day of the week, i now need it so that on the first prompt its monday, 2nd prompt tuesday etc etc,
Can anyone point me in the right direction (i don't want the answer, i just need some direction because im clueless!) Please help!
<HTML>
<HEAD>
<TITLE> Number of library books borrowed
</TITLE>
<SCRIPT >
/* Program to read in a known number of data items and store them in an array */
var booksArray = new Array (5);
var dayNamesArray = ['Monday','Tuesday','Wednesday','Thursday','Friday'];
document.write('Array program to read in a known number of data items');
for (var day = 0; day < booksArray.length; day = day + 1)
{
booksArray[day] = window.prompt('Enter number of books borrowed on ' + (dayNamesArray + 1),'')
};
document.write('<BR>' + '<BR>');
document.write('Confirmation of number of books borrowed' + '<BR>' + '<BR>');
for (var day = 0; day < booksArray.length; day = day + 1)
{
document.write(dayNamesArray[day] + ' : ' + booksArray[day] + '<BR>')
}
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>