Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 8th, 2007, 08:37 AM
Registered User
 
Join Date: Aug 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript Array Problem

Hi

Sorry if this is a really simple task buts its been driving me nuts over the past 2 weeks all i seem to do is go around in circles.

Basically all i want the following code to do is to link the booksArray to the dayOfWeek array so that when the window prompt appears it say "enter books borrowed for [DAY]" and when its displayed using the document.write statement at the bottow it should appear as "books borrowed on [DAY] was [VALUE]"

var booksArray = new Array (5);
var dayOfWeek = ('Mon','Tues','Wed','Thurs','Fri');

document.write('Array program to show............');

for (var dayOfWeek = 0; dayOfWeek < booksArray.length; dayOfWeek = dayOfWeek + 1)
{
booksArray[dayOfWeek] = window.prompt(Enter number of books for ' + dayOfWeek, '')
};
document.write('<BR>' + '<BR>');

for (var dayOfWeek = 0; dayOfWeek < booksArray.length; dayOfWeek = dayOfWeek + 1)
{
document.write('Books borrowed on ' + dayOfWeek[booksArray] + ' was ' + booksArray[dayOfWeek] + '<BR>')
)

many thanks for you time and apologies if this is really simple but as mentioned above its driving me nuts!!!

Kev








Similar Threads
Thread Thread Starter Forum Replies Last Post
Dotnet array object in javascript ramesh.b ASP.NET 1.0 and 1.1 Basics 0 November 26th, 2007 07:27 AM
Field Array Validation in Javascript Asad Khan Apache Tomcat 1 September 4th, 2007 06:14 AM
Reference ASP Array in Javascript gaetano Classic ASP Basics 1 February 21st, 2005 10:09 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.