User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 397,775 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,487 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1004 | Replies: 1
Reply
Join Date: Oct 2006
Posts: 2
Reputation: mikel_2006 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mikel_2006 mikel_2006 is offline Offline
Newbie Poster

Javascript Help

  #1  
Oct 13th, 2006
Hello Everyone, I am having quite a problem with a program I am trying to get working. I am trying to make a marks tracking program using an array that has an array of strings 3 elements long called Names.
Has a 2D array of integers 3 * 2 elements in size called Marks.
Has an array of floating point numbers 3 elements called Averages.
Prompt the user for 3 student names. Store the values in the Names array.
For each student: Prompt the user for marks in 2 classes: Math and Chemistry.
Calculate the average mark for each student. Store the averages in the Averages array.
print all student names, marks and averages on the screen. Here is what I have already..

<script type="text/javascript">

var Names = new Array();
var Marks = new Array();
var Averages = new Array();

Names[0] = "Matt";
Names[1] = "Tom";
Names[2] = "Kelly";

Marks[0][1] =
Marks[0][2] =
Marks[1][1] =
Marks[1][2] =
Marks[2][1] =
Marks[2][2] =

Averages[0] =
Averages[1] =
Averages[2] =

Names = prompt("Enter The First Students Name (Matt, Tom or Kelly)");
Marks = prompt("Enter The Math Mark for " + Names)
prompt("Enter The Chemistry Mark for " + Names)

</script>

I am completely stumped so any help at all would be awesome.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2004
Location: Hemet, CA
Posts: 427
Reputation: FC Jamison is on a distinguished road 
Rep Power: 5
Solved Threads: 17
Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Javascript Help

  #2  
Oct 16th, 2006
The problem is that your array

Names[0] "Matt"

Is actually a two dimensional array of characters...so

Names[0][0] = 'M'
Names[0][1] = 'A'

etc.

You will need to use something like this...

tmenu[3] = [["Departments", "#", "dropdown"]];
		smenu[3] = new Array(); fmenu[3] = new Array();
		smenu[3][1] = [["Administration", "#", "noFlyout"]];
		smenu[3][2] = [["Human Resources", "#", "flyout"]];
			fmenu[3][2] = new Array();
			fmenu[3][2][1] = [["Home Page", "#"]];
			fmenu[3][2][2] = [["Employment Opportunities", "#"]];
			fmenu[3][2][3] = [["Teach in Iowa", "#"]];
			fmenu[3][2][4] = [["Info for Teacher Candidates", "#"]];
			fmenu[3][2][5] = [["Master Contract", "#"]];
			fmenu[3][2][6] = [["Iowa Teaching Standards", "#"]];
			fmenu[3][2][7] = [["Non-Discrimination Policy", "#"]];
		smenu[3][3] = [["School Improvement", "#", "noFlyout"]];
		smenu[3][4] = [["Financial Information", "#", "noFlyout"]];
		smenu[3][5] = [["Facilities", "#", "noFlyout"]];
		smenu[3][6] = [["Food Service", "#", "flyout"]];
			fmenu[3][6] = new Array();
			fmenu[3][6][1] = [["Home Page", "#"]];
			fmenu[3][6][2] = [["Account Balances", "#"]];
		smenu[3][7] = [["Child Care", "#", "noFlyout"]];
		smenu[3][8] = [["Transportation", "#", "noFlyout"]];
		smenu[3][9] = [["Adult Education", "#", "noFlyout"]];
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:41 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC