Hands On Exercise
Hands On Exercise
Do the following:
3. Within the article element, directly below the h2 element, enter the
opening and closing tags of a script element on separate lines.
4. Within the script insert a JavaScript line comment containing the text
create ordered list.
<ol>
</ol>
6. Save your work and open project01-01.html in your web browser. Verify
the content of the page resembles that
In this project, you will create a web page that uses variables to display
information about high-speed Internet
Do the following:
5. Go to the first table row of the tbody section of the web table. Within the
first <td> tag, insert a script to write the value of the service1Name
variable. Within the second <td> tag, insert another script to write the value
of the service1Speed variable.
6. Repeat Step 5 for the two cells in each of the next three table rows in the
tbody section, writing the values of service2Name and service2Speed
variables through the service4Name and service4Speed variables.
7. Save your work and then open project01-02.html in your web browser.
Verify that the content of the page resembles that shown in Figure 1-24. The
figure shown above.
document.getElementById('id').innerHTML = 'text';
where id is the value of the id attribute for the page element and text is the
text of the content to be written into the element. You will use this
expression to enhance a web form by displaying the message “Thank you for
your order” when the user clicks the Submit button.
Do the following:
2. Scroll down to the bottom of the file and locate the input element for the
Submit button.
3. Add an onclick event handler to the <input> tag that changes the
innerHTML value of the page element with the id “submitMsg” to the text
message Thank you for your order. (Note: The entire JavaScript
expression should be enclosed within a set of double quotation marks, but
the id and the text message should be enclosed within single quotes.)
4. Save your changes to the file and then open project01-03.html in your
web browser. Click the Submit button and verify that the text “Thank you for
your order” appears on the bottom of the page.
document.getElementById('id').value = variable;
where id is the value of the id attribute of a web form element and variable is
the variable value to write into the element. A preview of the completed
project is shown in Figure 1-26.
Do the following:
workCode = “02104”.
5. Directly below the closing </div> tag for the Home address, insert a script
element. Within the script, insert commands to write the following two lines
of HTML code:
homeStreet <br>
You will have to use the add operator ( 1 ) to combine the variables with the
literal text strings in these two
lines of code.)
6. Directly below the closing </div> tag for the Work address, insert another
script element. Within the script,
workStreet <br>
where workStreet, workCity, workState, and workCode are once again the
variables you defined in
Step 2.
7. Go to the input element with the id “homeoption”. Within the <input> tag
insert an onclick event handler that contains the following four JavaScript
commands:
(a) Set the value of the of the element with the id “street” to the value of the
homeStreet variable;
(b) Set the value of the element with the id “city” to the homeCity variable;
(c) Set the value of the element with the id “state” to the homeState
variable;
(d) Set the value of the element with the id “code” to the value of the
homeCode variable.
9. Save your changes to the file and then load project01-04.html in your
web browser. Verify that the contents of the page resemble that shown in
Figure 1-26 and that you can switch the address information at the bottom of
the page between home and work by clicking the corresponding option
buttons.
Do the following:
1. Use your code editor to open project01-05_txt.html from the js01 c
project05 folder. Enter your name and the date in the comment section of
the document and save it as project01-05.html.
2. In the head section of the document there is a script that declares and
initializes the reopenDate variable.
3. Scroll down to the script embedded within the article element. The code
contains a total of four errors.
4. Save your changes to the file and then open the file in your web browser.
Verify that the page resembles that