worldtraveller
11-15-2010, 02:37 AM
Hello all out there I am going to post this in 2 separate views.
I am working on an assignment from this link
http://books.google.ca/books?id=aG_T2aD ... MonthCell()&source=bl&ots=EJXyGF-tbI&sig=vbgqgua2uSaL6DWp0Rx_BYoZ0z8&hl=en&ei=9C7gTLmiAYaXnAeywLWRDw&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBcQ6AEwAA#v=onepage&q=writeMonthCell()&f=false
if u scroll down to case 1
is what I am working on
included in the case are 2 other files as to the one i have to work on
i used all the proper steps and instructions and i think I have the correcting coding for my form
however my program still does not work
here is the exact code i am using
let me know if anyone sees any errors, as I am convinced i have it correct?
Here is my code:
<html>
<head>
<!--
New Perspectives on JavaScript
Tutorial 3
Case Problem 1
The Lighthouse
Author: John Res
Date: November 14 2010
Filename: clist.htm
Supporting files: lhouse.css, list.js, logo.jpg
-->
<title>The Lighthouse</title>
<link href="lhouse.css" rel="stylesheet" type="text/css" />
<script type"text/javascript" src"list.js"></script>
<script type="text/javascript">
function amountTotal() { // return sum of values to amount array
total=0;
for(var i=0; i<amount.length; i++) { // set variable to 0
total+=amount[i];
}
return total;
}
</script>
</head>
<body>
<div id="title">
<img src="logo.jpg" alt="The Lighthouse" />
The Lighthouse<br />
543 Oak Street<br />
Delphi, KY 89011<br/>
(542) 555-7511
</div>
<div id="data_list">
<script type=”text/javascript”> // set up variables of rows and cellspaces
document.write(“<table border=’1′ rules=’rows’ cellspacing=’0′>”);
document.write(“<tr><th>Date</th><th>Amount</th><th>First Name</th>”);
document.write(“<th>Last Name</th><th>Address</th></tr>”);
for (i=0; i< amount.length; i++) { // create a loop in counter of variable starting at 0 and increase of 1 increments
if (i%2==0) document.write(“<tr>”);
else document.write(“<tr class=’yellowrow’>”); // have every row with a yellow background use a loop
document.write(“<td>”+date[i]+”</td>”);
document.write(“<td class=’amt’>”+amount[i]+”</td>”); // have values of the dates
document.write(“<td>”+firstName[i]+”</td>”);
document.write(“<td>”+lastName[i]+”</td>”);
document.write(“<td>”);
document.write(street[i]+”<br />”);
document.write(city[i]+”, “+state[i]+” “+zip[i]); // zip arrays for address
document.write(“</td>”);
document.write(“</tr>”);
}
document.write(“</table>”);
</script>
</div>
<div id="totals">
<script type=”text/javascript”> // use script elements in HTML
document.write(“<table border=’1′ cellspacing=’1′>”);
document.write(“<tr><th id=’sumTitle’ colspan=’2′>Summary</th></tr>”);
document.write(“<tr><th>Contributors</th>”);
document.write(“<td>”+amount.length+”</td></tr>”);
document.write(“<tr><th>Amount</th>”);
document.write(“<td>$”+amountTotal()+”</td></tr>”);
document.write(“</table>”);
</script>
</div>
</body>
</html>
thanks everyone
I am working on an assignment from this link
http://books.google.ca/books?id=aG_T2aD ... MonthCell()&source=bl&ots=EJXyGF-tbI&sig=vbgqgua2uSaL6DWp0Rx_BYoZ0z8&hl=en&ei=9C7gTLmiAYaXnAeywLWRDw&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBcQ6AEwAA#v=onepage&q=writeMonthCell()&f=false
if u scroll down to case 1
is what I am working on
included in the case are 2 other files as to the one i have to work on
i used all the proper steps and instructions and i think I have the correcting coding for my form
however my program still does not work
here is the exact code i am using
let me know if anyone sees any errors, as I am convinced i have it correct?
Here is my code:
<html>
<head>
<!--
New Perspectives on JavaScript
Tutorial 3
Case Problem 1
The Lighthouse
Author: John Res
Date: November 14 2010
Filename: clist.htm
Supporting files: lhouse.css, list.js, logo.jpg
-->
<title>The Lighthouse</title>
<link href="lhouse.css" rel="stylesheet" type="text/css" />
<script type"text/javascript" src"list.js"></script>
<script type="text/javascript">
function amountTotal() { // return sum of values to amount array
total=0;
for(var i=0; i<amount.length; i++) { // set variable to 0
total+=amount[i];
}
return total;
}
</script>
</head>
<body>
<div id="title">
<img src="logo.jpg" alt="The Lighthouse" />
The Lighthouse<br />
543 Oak Street<br />
Delphi, KY 89011<br/>
(542) 555-7511
</div>
<div id="data_list">
<script type=”text/javascript”> // set up variables of rows and cellspaces
document.write(“<table border=’1′ rules=’rows’ cellspacing=’0′>”);
document.write(“<tr><th>Date</th><th>Amount</th><th>First Name</th>”);
document.write(“<th>Last Name</th><th>Address</th></tr>”);
for (i=0; i< amount.length; i++) { // create a loop in counter of variable starting at 0 and increase of 1 increments
if (i%2==0) document.write(“<tr>”);
else document.write(“<tr class=’yellowrow’>”); // have every row with a yellow background use a loop
document.write(“<td>”+date[i]+”</td>”);
document.write(“<td class=’amt’>”+amount[i]+”</td>”); // have values of the dates
document.write(“<td>”+firstName[i]+”</td>”);
document.write(“<td>”+lastName[i]+”</td>”);
document.write(“<td>”);
document.write(street[i]+”<br />”);
document.write(city[i]+”, “+state[i]+” “+zip[i]); // zip arrays for address
document.write(“</td>”);
document.write(“</tr>”);
}
document.write(“</table>”);
</script>
</div>
<div id="totals">
<script type=”text/javascript”> // use script elements in HTML
document.write(“<table border=’1′ cellspacing=’1′>”);
document.write(“<tr><th id=’sumTitle’ colspan=’2′>Summary</th></tr>”);
document.write(“<tr><th>Contributors</th>”);
document.write(“<td>”+amount.length+”</td></tr>”);
document.write(“<tr><th>Amount</th>”);
document.write(“<td>$”+amountTotal()+”</td></tr>”);
document.write(“</table>”);
</script>
</div>
</body>
</html>
thanks everyone