Calculating a Table Decide on what table you will calculate in this Application
ID: 3739948 • Letter: C
Question
Calculating a Table
Decide on what table you will calculate in this Application and create a new, appropriately named, page in your website. Complete the XHTML code for the head and create a shell for the body. Write an appropriate headline and introductory paragraph and also the XHTML for the table and its header row. Link to this newly created page from your home page.
In place of the data rows for the table, write a <script> tag. Specify text/javascript as the type and as the source (src), use the XHTML page name with the .js extension. For example, if your page is named table.php, use the name table.js as the JavaScript source file.
Now create the table.js file, where you write the JavaScript code. Use a loop that generates one row of the table each time it executes. The document.write function lets you generate both XHTML tags and content for the page. Remember to start and end each row with the <tr> and </tr> tags, and to use the <td> and </td> tags to enclose the calculated values you want to display. The example below calculates 15%, 18%, and 20% tips for meals costing between $8 and $25.
Submit your pages to the W3C Validator (http://validator.w3.org/) and correct all errors. (Note: You may ignore an error concerning placement of the script element.) Include screenshots of the results in your submission. Include the full XHTML code for each page and screenshots of the pages as your web browser displays them. Summarize the steps you followed to create and perfect the website.
Explanation / Answer
calculator
< HTML>
< head>
< script type="text/javascript">
var n;
function eval1(Calc)
{
n=eval(Calc.Input.value);
Calc.Input.value=n;
}
function f1(Calc)
{
Calc.Input.value=" ";
}
< /script>
< /head>
< BODY bgcolor=#364888 text=red>
< center>
< FORM NAME="Calc">
< table border=4>
< TR>
< TH>
< input type=text name=t1 style=text-align:center value=CASIO size=17 style=text-color:green>
< /TH>
< /TR>
< TR>
< TH>
< INPUT TYPE="text" NAME="Input" Size="17">
< /TH>
< /TR>
< table border=4>
< TR>
< TD>
< INPUT TYPE="button" NAME="seven" VALUE=" 1 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="eight" VALUE=" 2 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="nine" VALUE=" 3 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="plus" VALUE=" + "
>
< /TD>
< /TR>
< TD>
< INPUT TYPE="button" NAME="4"
VALUE=" 4 ">
< /TD>
< TD>
< INPUT TYPE="button" NAME="four" VALUE=" 5 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="five" VALUE=" 6 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="times" VALUE=" - "
>
< /TD>
< /TR>
< TR>
< TD>
< INPUT TYPE="button" NAME="nine" VALUE=" 7 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="nine" VALUE=" 8 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="nine" VALUE=" 9 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="minus" VALUE=" X "
>
< /TD>
< /TR>
< TR>
< TD>
< INPUT TYPE="button" NAME="point"
VALUE=" . ">
< /TD>
< TD>
< INPUT TYPE="button" NAME="zero" VALUE=" 0 "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="point"
VALUE=" c ">
< /TD>
< TD>
< INPUT TYPE="button" NAME="DIV" value=" / "
>
< /TD>
< /TR>
< TR>
< TD>
< INPUT TYPE="button" NAME="bracket"
VALUE=" ( ">
< /TD>
< TD>
< INPUT TYPE="button" NAME="zero" VALUE=" ) "
>
< /TD>
< TD>
< INPUT TYPE="button" NAME="point"
VALUE=" %">
< /TD>
< TD>
< INPUT TYPE="button" NAME="DIV" value=" = "
>
< /TD>
< /TR>
< /TABLE>
< /FORM>
< /center>
< /BODY>
< /HTML>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.