JavaScript IM Project 1

advertisement
Instructor’s Materials to accompany
JAVASCRIPT
PROJECT ONE
INTEGRATING JAVASCRIPT AND HTML
LESSON PLAN
OBJECTIVES
Students will have mastered the material in this project when they can:
 Discuss how to integrate JavaScript and
 Extract the system date
HTML
 Use several variables to construct a
 Insert SCRIPT tags on a Web page
message
 Write beginning and ending SCRIPT
 Describe the write() method of the
tags
document object
 Define and use flickering to draw
 Write a user-defined function that
attention
displays a message and links viewers to
 Describe the background color property
a new site
of the document object
 Describe how the setTimeout() method

Set the background color of a Web page
using JavaScript
 Save the HTML file
 Test the Web page
 Discuss JavaScript variables
works
 Use the lastModified property to display
the last modified document date
 Print an HTML Notepad file
PROJECT OVERVIEW
The Web page created in this project serves as a notice to Fun with Phonics customers indicating
that the Web site has moved to a new location. In creating this project, students learn how to
modify a Web page using the Notepad text editor. They learn how and where to place JavaScript
code on a Web page. The project introduces the concepts of creating new objects by defining
variables, such as with the Date() object. Students learn the rules for naming variables and how
to extract only the date from the user’s computer system. Students learn how to write a userdefined function that calls the built-in alert function to display a message. Students learn how to
embed HTML codes within JavaScript code and to format displayed text in the document.
Students learn to use the setTimeout() method to call a JavaScript function.
J 1.1
J 1.2 Project 1 Integrating JavaScript and HTML
LESSON PLAN
Project Outline
 Ready, Set, Stop —
BMW's Driving School
Brakes New ground
Page
Teacher Notes and Activities
J 1.2
Use the Ready, Set, Stop to discuss the power
of JavaScript. Emphasize how JavaScript
allows Web developers to add creative
interaction to their Web pages. Tell students
that as they learn advanced features of
JavaScript and HTML, they will be able to
combine HTML style sheets and JavaScript to
create dynamic pages. Have students check
out the BMW site at www.bmwusa.com.
I. Introduction
J 1.4
Define e-commerce and discuss how it has
grown with the World Wide Web. Discuss the
importance of the cyber marketplace. Ask
students if they have shopped online or filled
out forms on a Web page. Ask students if they
have encountered sites that have moved or
changed their domain name. Define objectbased. Describe how objects are real things.
Ask students to name some objects. Define
properties. Ask students to name some
properties of the objects they identified.
Describe the general form of an object. Define
methods. Ask students to think of methods for
some objects. Use Table 1-1 to discuss some
common JavaScript objects and properties.
Define event. Discuss the More About Ecommerce; Auto-by-Tel, Dell, and E-trade;
and Domain Names boxes. Use Table 1-2 to
discuss the general form of an event handler.
Discuss the event handlers. Refer to the Table
I-8 in the Introduction.
II. Project One — Fun with
Phonics Web Page
J 1.6
Use Figures 1-1a and 1-1b to describe how a
Web site that has moved can notify users.
JavaScript Instructor’s Materials J 1.3
Project Outline
Page
Teacher Notes and Activities
Point out the alert() message in Figure 1-1b.
Use Figure 1-1c to discuss how JavaScript
integrates with HTML code. Discuss the More
About Scripting Languages box.
Starting Notepad
J 1.8
Use Figures 1-2 and 1-3 to describe how to
start Notepad. Use Figures 1-4 through 1-6 to
describe how to open the fun.htm file stored
on the JavaScript Data Disk. Discuss the
Other Ways to open a file box.
III. Inserting SCRIPT tags on
a Web page
J 1.11
Describe the WYSIWYG editors like Front
Page. Review that all HTML tags must have a
beginning and ending tag. Discuss the
SCRIPT tag. Discuss the More About
JavaScript box.
Writing the beginning
J 1.11
Discuss the general form of the SCRIPT tag.
Discuss the importance of the HTML
SCRIPT tag
comment to hide the script from old browsers.
Discuss the More About JavaScript Comment
Lines box. Use Figures 1-7 and 1-8 to
describe how to enter the beginning SCRIPT
tag and comment line.
IV. Using a flicker on a Web
page to draw attention
J 1.12
Ask students to describe ways to get a user's
attention on a Web page. Describe the purpose
of the background color property. Discuss
how to assign a color to the background. Use
Figures 1-9 and 1-10 to enter the code to
make the Web page flicker. Discuss the More
About The Document Object and Background
Color Codes boxes. Remind students of the
importance of spelling tags and property
names.
A. Setting the
J 1.14
Use Figure 1-11 to describe how to set the
J 1.4 Project 1 Integrating JavaScript and HTML
Project Outline
Page
Teacher Notes and Activities
background color to a static color.
background color to a
static color
B. Completing the
J 1.15
Discuss the ending SCRIPT tags. Explain the
purpose of the JavaScript comment to end the
HTML comment. Use Figure 1-12 to describe
how to enter the ending SCRIPT tag.
J 1.16
Explain that Notepad saves files with the .txt
JavaScript section
V. Saving the HTML file
extension and students must save the file with
an .htm extension. Emphasize saving the file
to their Data Disk in drive A. Use Figures 113 through 1-15 to present saving the HTML
file on the floppy disk. Remind students to
remember the name of the file. Discuss the
other Ways to save the file on the floppy disk
box.
VI. Testing the Web page
J 1.18
Discuss testing the JavaScript code. Describe
the kind of errors that can be made: spelling,
incomplete quotation marks, missing periods,
and missing parentheses. Use Figure 1-16 to
explain activating the browser and opening
the HTML file in the browser.
VII. JavaScript variables
J 1.19
Discuss the use of variables in any
programming language and explain that
variables are used the same way in JavaScript.
Use Table 1-3 to discuss the rules for naming
variables. Discuss the More About Variables
box. Explain how JavaScript variables are
loosely typed. Discuss the three examples on
how to assign values to variables. Discuss the
use of var keyword.
VIII. Extracting the system
date
J 1.20
Describe the Date() object. Explain how it is a
built-in object. Discuss the examples of how
JavaScript Instructor’s Materials J 1.5
Project Outline
Page
Teacher Notes and Activities
to use the Date() object to assign or extract the
system date. Discuss the string of data that
Date() object returns and how it differs among
browsers. Use Table 1-4 to explain the use of
the toLocaleString() and substring() methods.
Define relative addressing and describe how
the substring() method uses relative
addressing using Table 1-5. Discuss the More
About The System Date and Extracting the
System Date boxes. Use Figures 1-17 and 118 to write the statements to extract the
current system date using the Date() object.
Displaying the current
J 1.23
system date
Use Table 1-6 to discuss the write() and
writeln() methods. Explain concatenation.
Discuss the example that shows how to
concatenate string and variables in a
JavaScript write() method statement. Discuss
the More About writeln() box. Use Figure 119 to describe how to display the current
system date in the initial greeting.
IX. Using several variables to
construct a message
Writing the message on
J 1.24
Explain the 255 character limit in a line. Use
Figure 1-20 to demonstrate how to construct a
message using several variables.
J 1.25
Use Figure 1-21 to describe how to write the
message on the Web page. Point out that line
28 contains embedded HTML tags used to
the Web page
format the output.
X. Save and test the Web
page
J 1.26
Use Figure 1-22 to remind students they must
save the HTML before they can test the
JavaScript code. Explain that the Save
command saves the file with the current name.
Discuss the Other Ways to save a file box.
Use Figure 1-23 to explain how to test the
J 1.6 Project 1 Integrating JavaScript and HTML
Project Outline
Page
Teacher Notes and Activities
Web page in the browser. Discuss how to look
for errors and how to retrace their steps.
Explain how to activate Notepad.
XI. Calling a JavaScript
function
J 1.28
Explain the methods for calling a JavaScript
function. Use Table 1-7 to describe the
setTimeout() method. Point out the userdefined function name, and the time delay.
Explain how the time delay is set. Use Figure
1-24 to write the setTimeout() method to
execute the chngSite() user-defined function.
Discuss the More About setTimeout() box.
XII. Displaying the last
modified document date
J 1.29
Explain how JavaScript can be used to display
the date the Web page was last modified using
the lastModified property. Explain how to
display the date last modified with the write()
method. Point out in the example the
embedded HTML codes. Use Figure 1-25 to
describe how to display the date last modified.
XIII. Writing a JavaScript
user-defined function
J 1.29
Define function. Use Table 1-8 to discuss
some of the built-in functions. Define userdefined function. Use Table 1-9 to describe
the general form of a user-defined function.
Describe how to call a function. Use Table 110 to discuss the naming conventions of userdefined functions. Point out the example that
allows built-in functions used within userdefined functions. Use Table 1-11 to discuss
the prompt() and confirm() built-in functions.
Discuss the More About Functions box.
Placing user-defined
functions in the
HEAD section
J 1.31
Differentiate between the HEAD and BODY
sections. Remind students Web developers
recommend placing user-defined functions in
the HEAD section. Use Figures 1-26 and 1-27
JavaScript Instructor’s Materials J 1.7
Project Outline
Page
Teacher Notes and Activities
to describe how to enter the chngSite() userdefined function in the HEAD section.
Remind students how to save and test the
HTML file. Remind students of the kind of
errors that could be made and how to fix
them. Use Figures 1-28a and 1-28b to show
the completed HTML file.
XIV. Printing the HTML file
J 1.35
using Notepad
XV. Project summary
XVI. What you should know
XVII. Test your knowledge
XVIII. Use Help
XIX. Apply your knowledge
Use Figure 1-29 to explain how to print the
HTML file using Notepad. Point out that the
dialog box will display quickly. Discuss the
More About Printing with Notepad box. Use
Figure 1-30 to show the completed project.
J 1.36
Briefly review the material presented in this
project.
J 1.36
Encourage students to use this section in
preparing for tests and quizzes.
J 1.37
These exercises test students on their mastery
of the material presented in this project.
Exercises 1 through 4 can be reviewed and
assigned at this time.
J 1.40
These exercises ask students to use JavaScript
Help to find out more about working with
JavaScript. Exercises 1 and 2 can be reviewed
and assigned at this time.
J 1.41
This exercise gives students a chance to apply
their knowledge to a document on the
JavaScript Data Disk. Exercise 1 can be
reviewed and assigned at this time.
XX. In the lab
J 1.42
These exercises provide students with practice
in using the skills developed in this project.
Exercises 1 through 3 can be reviewed and
assigned at this time.
J 1.8 Project 1 Integrating JavaScript and HTML
Project Outline
XXI. Cases and places
Page
Teacher Notes and Activities
J 1.48
These exercises offer students the opportunity
to learn more about programming JavaScript
through open-ended activities with varying
degrees of difficulty. Students can be assigned
one or more exercises, or allowed to choose
the exercises in which they are most
interested.
Instructor’s Materials to accompany
JAVASCRIPT
PROJECT ONE
INTEGRATING JAVASCRIPT AND HTML
ANSWER MANUAL
TEST YOUR KNOWLEDGE
1
True/False
1.
2.
2
3.
4.
T
F
5.
6.
F
T
7.
8.
F
F
9.
10.
T
F
3.
4.
b
d
5.
6.
b
a
7.
8.
b
c
9.
10.
c
c
Multiple Choice
1.
2.
3
F
T
a
c
Understanding the Various Parts of a Web Page
1.
beginning SCRIPT tag
2.
HTML comment to hide script
3.
alert() built-in function
4.
argument in alert() built-in
function
5.
ending comment
6.
JavaScript comment
7.
JavaScript document.write()
method
8.
call user-defined function
sample()
J 1.9
4
Understanding Code Statements
1.
var OurTime = Date()
2.
LocOurTime = OurTime.toLocaleString()
3.
document.bgColor = "springgreen"
4.
var CompMsg = Msg1 + Msg2 + Msg3
5.
setTimeout("newWindow()", 5000)
6.
document.write("This document was last changed on: "+curDate+".")
<Input Type = "Button" Name = "Continue" Value = "Continue" onclick="goNext()">
USE HELP
1
Exploring Online Documentation
1. JavaScript is Netscape's cross-platform, object-based scripting language for client and
server applications. JavaScript lets you create applications that run over the Internet.
Client applications run in a browser, such as Netscape Navigator, and server applications
run on a server, such as Netscape Enterprise Server. Using JavaScript, you can create
dynamic HTML pages that process user input and maintain persistent data using special
2 a.
b.
c.
d.
e.
3.
objects, files, and relational databases. Through JavaScript's LiveConnect functionality,
your applications can access Java and CORBA distributed-object applications.
JavaScript
Java — Objects are divided into classes and instances with all inheritance through the
class hierarchy.
Java
JavaScript
JavaScript
Using JavaScript entities, you can specify a JavaScript expression as the value of an
HTML attribute. Entity values are evaluated dynamically. This allows you to create more
flexible HTML constructs, because the attributes of one HTML element can depend on
information about elements placed previously on the page.
JavaScript entities also start with an ampersand (&) and end with a semicolon (;). Instead
of a name or number, you use a JavaScript expression enclosed in curly braces {}. You
can use JavaScript entities only where an HTML attribute value would normally go. For
example, suppose you define a variable bar Width. You could create a horizontal rule
with the specified percentage width as follows:
J 1.10
JavaScript Instructor’s Materials J 1.11
<HR WIDTH="&{barWidth};%" ALIGN="LEFT">
As with other HTML, after layout has occurred, the display of a page can change only if
you reload the page. Unlike regular entities that can appear anywhere in the HTML text
flow, JavaScript entities are interpreted only on the right-hand side of HTML attribute
name/value pairs. For example, if you have this statement: <H4>&{myTitle};</H4> It
displays the string myTitle rather than the value of the variable myTitle.
4. Use the <NOSCRIPT> tag to specify alternate content for browsers that do not support
JavaScript. Browsers that do not support JavaScript display HTML code enclosed within
a <NOSCRIPT> tag; Navigator ignores code within the tag. Note however, that if the
user has disabled JavaScript from the Advanced tab of the Preferences dialog, Navigator
displays the code within the <NOSCRIPT> tag.
5 a. Functions are one of the fundamental building blocks in JavaScript. A function is a
JavaScript procedure — a set of statements that performs a specific task. A function
definition has these basic parts: the function keyword, a function name, a commaseparated list of arguments to the function in parentheses, and the statements in the
function in curly braces.
b. Defining the function simply names the function and specifies what to do when the
function is called. Calling the function actually performs the specified actions with the
indicated parameters.
c. Generally, you should define the functions for a page in the HEAD portion of a
document. That way, all functions are defined before any content is displayed. Otherwise,
the user might perform an action while the page still is loading that triggers an event
handler and calls an undefined function, leading to an error.
6. The write method of document displays output in the browser. "Big deal," you say,
"HTML already does that." But in a script you can do all kinds of things you cannot do
with ordinary HTML. For example, you can display text conditionally or based on
variable arguments. For these reasons, write is one of the most often-used JavaScript
method.
2
Exploring Links to Other JavaScript Site Links
4. Students should submit a printout of the final page of Chapter 1, The Message Box.
6. Students should submit a printout of the last page of the Show me how.
J 1.12 Project 1 Integrating JavaScript and HTML
APPLY YOUR KNOWLEDGE
1
Changing the Message and Linking to New Web Site for an Initial Screen
10. The completed project for this assignment is supplied in the Instructor’s Lab Solutions
section on the Instructor’s Resource Kit CD-ROM as the carrentalsolution.htm file.
11. Students should submit a printout of the HTML file and the Web page.
IN THE LAB
1
Writing a Function that Changes Background Colors
7. The completed project for this assignment is supplied in the Instructor’s Lab Solutions
section on the Instructor’s Resource Kit CD-ROM as the jstutorsolution.htm file.
Students should submit a printout of the Web page and the HTML file.
2
Adding Alert Messages to Display a Factoid before Executing a Link
10. The completed project for this assignment is supplied in the Instructor’s Lab Solutions
section on the Instructor’s Resource Kit CD-ROM as the valleysolution.htm file.
Students should submit a printout of the Web page and the HTML file.
3
Creating a Welcome Page that Displays Information in an Alert Message
9. The completed project for this assignment is supplied in the Instructor’s Lab Solutions
section on the Instructor’s Resource Kit CD-ROM as the rockysolution.htm file.
Students should submit a printout of the Web page and the HTML file.
Instructor’s Materials to accompany
JAVASCRIPT
PROJECT ONE
INTEGRATING JAVASCRIPT AND HTML
TEST BANK

Test Bank Answers are on page J 1.22.
Multiple Choice
46. What is e-commerce?
a. a business activity that sells goods on the Internet
b. a business activity that takes place using networked computers and the Internet
c. a business activity that allows workers to telecommute from home
d. a promise of the future to deliver all aspects of business to the home
47. A language not capable of creating classes or using inheritance is called __________.
a. object-oriented
b. class-oriented
c. object-based
d. class-based
48. What describes an aspect about an object?
a. methods
b. properties
c. fields
d. columns
49. What are actions or built-in functions that an object performs called?
a.
b.
c.
d.
event handlers
object instances
functions calls
methods
50. How are JavaScript commands associated with an action?
a. event handlers
b. objects
J 1.13
J 1.14 Project 1 Integrating JavaScript and HTML
c. object properties
d. function calls
51. The Language attribute in the SCRIPT tag informs the browser __________.
a. how to call JavaScript functions
b. how to call VBScript subroutines
c. which scripting language to use
d. which server to use for processing
52. Omitting the Language attribute causes most browsers to default to __________.
a. VBScript
b. JavaScript
c. PERL
d. CGI
53. The bgColor attribute belongs to which object?
a. window
b. object
c. document
d. color
54. Which of the following is not a rule regarding JavaScript variable names?
a.
b.
c.
d.
must be more than 1 character in length
must begin with a character
may not contain spaces
avoid the use of reserved words
55. If a variable does not have to define its data type, it is referred to as __________.
a. character
b. loosely typed
c. string
d. Boolean
56. Which data type contains logical data (i.e., True or False)?
a. numeric
b. Bouillon
c. string
d. Boolean
JavaScript Instructor’s Materials J 1.15
57. A JavaScript object that does not depend or belong to another object is called a(n)
__________.
a. free object
b. property
c. built-in object
d. attribute
58. Which method converts a date value to a string?
a. toLocaleString()
b. localeString()
c. substring()
d. localeSubString()
59. Which method extracts a portion of a string based on starting and ending positions?
a. sub(x,y)
b. mid(x,y)
c. submid(x,y)
d. substring(x,y)
60. What is the location of any character calculated in relation to the first character in the
string called?
a.
b.
c.
d.
absolute addressing
loosely typed addressing
relative addressing
relational addressing
61. In the method, substring(15, 29), the 29 is the __________.
a. length of the string
b. location of the last character in the string plus one
c. location of the last character
d. length of the string plus one
62. To join to link one or more strings together means to __________.
a. concatenate
b. merge
c. coalesce
d. integrate
63. JavaScript has __________ methods to call functions.
J 1.16 Project 1 Integrating JavaScript and HTML
a.
b.
c.
d.
one
two
three
four
64. One way to call a function is through the use of __________.
a. properties
b. objects
c. embedded properties
d. event handlers
65. The setTimeout() method can be used to call functions with a delay. The delay is stated in
__________.
a. microseconds
b. nanoseconds
c. milliseconds
d. hundredths of seconds
66. The lastModified property belongs to which object?
a. window
b. document
c. WebPages
d. Date()
67. What is JavaScript code that is written to perform certain tasks repeatedly called?
a. a JavaScript section
b. an object
c. a function
d. a method
68. A function written by the Web developer is called a(n)__________ function.
a. user-defined
b. event handler
c. method
d. property
69. Web developers generally agree user-defined functions are written in the __________
section.
a. BODY
b. FUNCTION
JavaScript Instructor’s Materials J 1.17
c. JAVASCRIPT
d. HEAD
70. Which dialog box returns True if the user clicks an OK button, or False if the user clicks
a cancel button?
a. prompt()
b. alert()
c. confirm()
d. dialog()
True/False
T F
71. Many companies build and use Web sites primarily to market and sell their
products and services.
T F
72. E-commerce is business activity that takes place using networked computers and
the Internet.
T F
73. Marketing experts state that you have 10 to 12 seconds to attract and retain
someone’s attention.
T F
74. Every successful company purchases and uses its own domain name on the
Internet.
T F
75. The 404 Object not found means the site is no longer registered in the Domain
Name Service.
T F
76. An object-based language like JavaScript can create its own class of objects.
T F
77. An object is a person, place, or thing.
T F
78. Properties are messages that objects use to cause actions.
T F
79. It is not possible to assign values to object properties.
T F
80. Methods are actions or functions that the object can perform.
T F
81. An event is another name for a method.
T F
82. Event handlers are the only way to call user-defined functions.
T F
83. All JavaScript code must be placed in the HEAD section.
T F
84. To designate a JavaScript section, you need to use the SCRIPT tag.
T F
85. The SCRIPT tag indicates you are using JavaScript, while the VBScript tag
J 1.18 Project 1 Integrating JavaScript and HTML
indicates you are using VBScript.
T F
86. If you omit the Language attribute from the SCRIPT tag, the browser
automatically uses JAVA.
T F
87. The document object property used to change text color is bgColor.
T F
88. The //--> tag indicates the end of the SCRIPT tag.
T F
89. Notepad automatically saves HTML files with the .txt extension.
T F
90. To store temporary data, you must create an object and define a property.
T F
91. A variable name may begin with any character, like a number.
T F
92. A variable name may contain spaces or periods.
T F
93. Loosely typed means you do not have to define the variable's data type as
numeric or string in advance.
T F
94. A string data type contains only characters.
T F
95. A numeric data type may contain numbers and characters.
T F
96. JavaScript does not have a Boolean data type.
T F
97. To indicate the data type, define the variable by assigning a value to the variable.
T F
98. The var keyword is not required in defining variables.
T F
99. A built-in object is a JavaScript object that does not depend on nor belong to
another object.
T F
100. To extract the current system date you use the Date(Current) JavaScript code.
T F
101. You cannot place or use another date in the Date() object.
T F
102. All browsers return the system date information in the exact same string format.
T F
103. In the substring(x,y) method, the x indicates the starting position of the string.
T F
104. Relative addressing means the exact location of the string item is known.
T F
105. You cannot embed HTML codes in the write() method.
T F
106. The writeln() method displays each message on a new line.
T F
107. You may concatenate strings together in the write() method.
T F
108. Old browsers have limit of 255 characters to a line.
T F
109. The setTimeout() method uses a time delay expressed in milliseconds.
JavaScript Instructor’s Materials J 1.19
T F
110. Ten seconds expressed in the setTimeout() method is 1000000.
T F
111. To display the date a document was last modified you use the
document.lastModified object and property.
T F
112. A function is JavaScript code that is written to perform a set of tasks only once.
T F
113. A user-defined function is one in which the Web developer writes the tasks to be
performed.
T F
114. JavaScript has no built-in functions.
T F
115. To call a function means to have JavaScript execute the commands associated
with the function.
T F
116. A user-defined function must begin with the function keyword.
T F
117. The JavaScript code in a user-defined function is placed between left and right
braces.
T F
118. You cannot use a built-in function from within a user-defined function.
T F
119. The prompt() function displays a text box in a dialog box to allow user input.
T F
120. Web developers agree that user-defined functions are placed in the HEAD
section.
Short Answer
121. Since 1996, many companies have developed and gained a substantial marketing edge
using __________.
122. A(n) __________ language uses built-in objects, but is not capable of creating classes of
objects using inheritance features.
123. __________ are attributes of objects and describe some aspect about the object.
124. Methods are __________ or __________.
125. A(n) __________ is the result of a user's action.
126. Most Web developers agree that the __________ section contains the user-defined
JavaScript functions.
127. If you omit the __________ attribute, most browsers default to JavaScript.
J 1.20 Project 1 Integrating JavaScript and HTML
128. The HTML comment line __________ any script language that a browser may not be
able to interpret.
129. A Web page can flicker using JavaScript code by changing the __________ in rapid
succession.
130. With HTML, you can set the background color once in the __________ tag with the
BGCOLOR attribute.
131. To complete a JavaScript section __________ sets of tags are required.
132. The JavaScript //--> tags close the __________ comment.
133. JavaScript variable names must begin with a letter or a(n) __________.
134. The remainder of a JavaScript variable name must be a(n) __________.
135. JavaScript variable names are __________.
136. Avoid the use of JavaScript object, properties, methods, and __________ as JavaScript
variable names.
137. __________ means you are not required to define the variable data types in advance.
138. String data types are variables that hold characters or combination of __________.
139. Boolean data types contain __________ data as True or False.
140. Although it is not required, most Web developers recommend using the __________
keyword when defining variables.
141. A(n) __________ is a JavaScript object that is not dependent on nor belongs to another
object.
142. The __________ method converts a string of characters into the default display format
used by the user's computer.
143. In the general form of the substring(x,y) method, the x is the location of the first character
the y represents the __________ of the last character plus one.
144. __________ means the location of any character in a string is calculated in relation to the
first character in the string.
145. The __________ method displays messages on a new line.
146. __________ means to join to link together.
147. The JavaScript symbol for concatenation is the __________.
JavaScript Instructor’s Materials J 1.21
148. Older browsers have a limit of __________ to a line.
149. One method to call a function is to use __________ and __________.
150. The setTimeout() method causes a delay measured in __________.
151. To display the date a Web page document was last modified use the __________
property of the __________ object.
152. A(n) __________ is JavaScript code that is written to perform certain tasks repeatedly.
153. A(n) __________ is one in which the Web developer writes the tasks to be performed.
154. To __________ a function means to have JavaScript execute the function code.
155. A function name must begin with a(n) __________, may contain numerals and the
underscore but may not contain any spaces, punctuation, or reserved words.
J 1.22 Project 1 Integrating JavaScript and HTML
TEST BANK ANSWERS FOR PROJECT 1
INTEGRATING JAVASCRIPT AND HTML
Multiple Choice
46. b [J 1.4]
51. c [J 1.11]
56. d [J 1.20]
61. b [J 1.21]
66. b [J 1.29]
47. c [J 1.5]
52. b [J 1.11]
57. c [J 1.20]
62. a [J 1.23]
67. c [J 1.29]
48. b [J 1.5]
53. c [J 1.13]
58. a [J 1.21]
63. b [J 1.28]
68. a [J 1.30]
49. d [J 1.5]
54. a [J 1.19]
59. d [J 1.21]
64. d [J 1.28]
69. d [J 1.31]
50. a [J 1.6]
55. b [J 1.20]
60. c [J 1.21]
65. c [J 1.28]
70. c [J 1.31]
True/False
71. T [J 1.4]
81. F [J 1.6]
91. F [J 1.19]
101. F [J 1.20] 111. T [J 1.29]
72. T [J 1.4]
82. F [J 1.6]
92. F [J 1.19]
102. F [J 1.20] 112. F [J 1.29]
73. F [J 1.4]
83. F [J 1.11]
93. T [J 1.20]
103. T [J 1.21] 113. T [J 1.30]
74. F [J 1.4]
84. T [J 1.11]
94. F [J 1.20]
104. F [J 1.21] 114. F [J 1.30]
75. F [J 1.4]
85. F [J 1.11]
95. F [J 1.20]
105. F [J 1.23] 115. T [J 1.30]
76. F [J 1.5]
86. F [J 1.11]
96. F [J 1.20]
106. T [J 1.23] 116. T [J 1.30]
77. T [J 1.5]
87. T [J 1.13]
97. T [J 1.20]
107. T [J 1.23] 117. T [J 1.30]
78. F [J 1.5]
88. F [J 1.15]
98. T [J 1.20]
108. T [J 1.24] 118. F [J 1.31]
79. F [J 1.5]
89. T [J 1.16]
99. T [J 1.20]
109. T [J 1.28] 119. T [J 1.31]
80. T [J 1.5]
90. F [J 1.19]
100. F [J 1.20]
110. F [J 1.28] 120. T [J 1.31]
Short Answer
121. e-commerce [J 1.4]
130. <BODY> [J 1.13]
122. object-based [J 1.5]
131. two [J 1.15]
123. Properties [J 1.5]
132. beginning HTML [J
124. actions, functions [J
1.5]
125. event [J 1.6]
126. HEAD [J 1.11]
1.15]
138. letters, numbers, or
symbols [J 1.20]
139. logical [J 1.20]
140. var [J 1.20]
133. underscore [J 1.19]
141. built-in object [J 1.20]
134. letter or underscore [J
142. toLocaleString() [J
1.19]
1.21]
127. Language [J 1.11]
135. case sensitive [J 1.19]
143. location [J 1.21]
128. hides [J 1.11]
136. reserved words [J 1.19]
144. Relative addressing [J
129. background color [J
137. Loosely typed [J 1.20]
1.12]
1.21]
145. writeln() [J 1.23]
146. Concatenate [J 1.23]
150. milliseconds [J 1.28]
147. plus sign (+) [J 1.23]
151. lastModified, document
148. 255 characters [J 1.24]
149. event handlers, object
methods [J 1.28]
[J 1.29]
152. function [J 1.29]
153. user-defined function [J
1.30]
154. call [J 1.30]
155. letter [J 1.30]
Download