Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the data below, create a simple web page that displays it. Store each colu

ID: 3658252 • Letter: G

Question

Given the data below, create a simple web page that displays it. Store each column of data into it's own array. Once stored, use Javascript to display the data in a series of repetitive statements: "In year [YEAR] region 3's demographic had [NUMBER] thousand 8-track players." This will require accessing the values in the arrays and a fair amount of string manipulation. Year Region 3's Demographic with 8-Track Tape Players (thousands) ------ ----------------------------------------------------------------------- 1970 4.6 1971 9.8 1972 23.3 1973 64.1 1974 97.0 1975 99.4

Explanation / Answer

tabledata.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<TABLE border="1" id="dataTable">
<TR>
    <TH>Year</TH>
    <TH> Region 3's Demographic with 8-Track Tape Players (thousands)</TH>
</TR>
<TR>
    <TD>1970</TD>
    <TD>4.6</TD>
</TR>
<TR>
    <TD>1971</TD>
    <TD>9.8</TD>
</TR>
<TR>
    <TD>1972</TD>
    <TD>23.3</TD>
</TR>
<TR>
    <TD>1973</TD>
    <TD>64.1</TD>
</TR>
<TR>
    <TD>1974</TD>
    <TD>97.0</TD>
</TR>
<TR>
    <TD>1975</TD>
    <TD>99.4</TD>
</TR>
</TABLE>
<INPUT TYPE="button" VALUE="Display Table Data in Statements">
<div id="msg"> </div>
   <script>
function display() {
        table = document.getElementById("dataTable");
        var rowCount = table.rows.length;
        var yearArray = new Array(rowCount-1);
        var messageArray = new Array(rowCount-1);
        var msg = "";
        for (var i = 1; i < rowCount - 1; i++) {   
            yearArray[i-1]= table.rows.item(i).cells.item(0).innerHTML;
            messageArray[i-1]= table.rows.item(i).cells.item(1).innerHTML;
            msg += " In year " + yearArray[i-1] + " region 3's demographic had " +messageArray[i-1] + " thousand 8-track players.<br/>"
        }
        document.getElementById("msg").innerHTML = msg;
}
</script>
</BODY>
</HTML>

output:

Year Region 3's Demographic with 8-Track Tape Players (thousands) 1970 4.6 1971 9.8 1972 23.3 1973 64.1 1974 97.0 1975 99.4
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote