HOME
NEXT PREV
JavaScript
Preface
Data Disks: www.course.com search for
JavaScript. Click "student downloads"
JavaScript
Comprehensive, Second Edition Don Gosselin,
ISBN: 0-619-06334-3 © Dec. 2001 [student
downloads]
Click 6334-3d.exe to
download to
C:\My
Documents\Installation\JavaScript\JavaScript2ndEditionDonGosselin\DataDisks
Execute 6334-3d.exe to unzip it.
This book is written to conform ECMAScript Edition 3, the most recent version
of the international, standardized version of JavaScript. You can use either
Netscape 6 and higher or Internet Explorer 4 and higher to create solutions to
the exercises in this text. To use Internet Explorer 4 with ECMAScript Edition
3, the user must install Windows Script 5.5, which can be download from:
http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/
- Netscape JavaScript Guide contents
http://developer.netscape.com/docs/manuals/communicator/jsref/contents.htm
- Netscape JavaScript Reference
http://www.microsoft.com/msdownload/vbscript/scripting.asp
: MS JavaScript download
ECMAScript Edition 3: Netscape JavaScript 1.5 and Microsoft JScript 5.5
Tutorial 1, Section A: Introduction to JavaScript
The JavaScript Programming Language
JavaScript is a scripting language. The term scripting language refers
to programming languages that are executed by an interpreter from within a Web
browser. An interpreter translates programming code into an executable
format each time the program runs, one line at a time. Programs written
in scripting languages, such as JavaScript, are interpreted when a scripting
engine loads an HTML page. A scripting engine is an interpreter that is
part of the Web browser. A Web browser that contains a scripting engine to
translate scripts is called a scripting host. Navigator and Internet
Explorer are both examples of scripting hosts for JavaScript program.
JavaScript is available in two formats: client-side JavaScript and
server-side JavaScript. Client-side execution refers to a program running
on a local browser (the client) instead of on a server. Server-side execution
refers to a program running on a server instead of on a client.
Clent-side JavaScript: Netscape JavaScript 1.5 and Microsoft JScript 5.5 are
client-side versions of JavaScripts.
Server-side JavaScript is used with Web servers to access file systems,
communicate with other applications, access data bases, and perform other tasks.
Currently, server-side JavaScript is proprietary and vendor-specific. There is
no server-side standard similiar to ECMAScript. Client-side and server-side
JavaScript share the same basic programming features (core features).
Tutorial 1, Section A, Questions:
- C - Hypertext Transfer Protocol manages the hypertext links
that are used to navigate the Web.
- C - Every document has a unique address known as a Uniform Resource
Locator.
- D - A domain name identifies one or more IP addresses.
- C - HTML elements may contain an ending tag, depending on the HTML
element.
- C - The Web browser process of assembling and formatting an HTML document
is called parsing or rendering.
- B - HTML is not case-sensitive.
- C - HTML attributes are placed
within before the closing bracket of the starting
tag.
- C - HTML documents start and end with the <HTML>...</HTML>
tag pairs.
- B - What is the correct syntax for a non-braking space code?
- A, B, and C - Which of the following can be used for creating HTML
documents?
- A text editor
- A word-processing program capable of creating simple text files
- An HTML editing program
- A Web browser
- C - The rules of a programming language are known as its syntax.
- A - The term scripting language refers to programming
languages that are executed by an interpreter from within a Web-browser.
- C - The most recent version of ECMAScript is Edition 3.
- D - Execute the various statements and procedures of a program in the
correct order to produce the desired results is called logic.
- B - The term machine language is used to refer to interpreted
languages that run from within a Web browsers.
- D - The version of JavaScript that is format available to HTML pages in a
Web browser is called client-side JavaScript.
Tutorial 1, Section B: Introduction to JavaScript
JavaScript is an object-based programming language.
For ECMAScript Edition 3, specify JavaScript as the script language. For
example:
<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
// JavaScript Statements;
document.writeln("Hello World");
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</SCRIPT>
<NOSCRIPT>
Your browser does not support JavaScript or JavaScript is disabled.<BR>
</NOSCRIPT>
<!-- JavaScript Source File -->
<SCRIPT LANGUAGE="JavaScript" SRC="samplesourcefile.js">
</SCRIPT>
Click here to
see examples of <SCRIPT> tag.
Tutorial 1, Section B, Questions:
- B - Scripting code in an HTML document is located between the
<SCRIPT>...</SCRIPT> tag pairs.
- C - The <SCRIPT> tag can be used with both JavaScript and
VBScript.
- D - Which of the following is not valid with the LANGUAGE attribute of the
<SCRIPT> tag? JavaScript 1.2
- C - When should you specify the JavaScript version number with the
LANGUAGE attribute of the <SCRIPT> tag?
For earlier versions of both
Navigator and Internet Explorer.
- C - If a Web browser does not support the version of JavaScript specified
by the LANGUAGE attribute, then the JavaScript statements contained in the
<SCRIPT>...</SCRIPT> tag pairs are ignored.
- D - An object refers to programming code and data that can
be treated as an individual unit or component.
- A - The JavaScript object that represents the content of a browser's
window is called the Document object.
- B - With JavaScript, new text is created on a Web page using the write()
method or the writeln() method.
- D - Which of the following is the correct syntax for including a quoted
string within a literal string?
"this is a 'quoted' string"
- D - The <PRE>...</PRE> tag pair tells a Web
browser that any text and line breaks it contains are to be rendered as is.
- C - Which of the following statements is correct?
document.write("Hello World")
- D - A JavaScript source file is called using the SRC
attribute of the <SCRIPT> tag.
- B - JavaScript source files cannot include HTML tags.
- A - When an HTML document calls a JavaScript source file, the
<SCRIPT>...</SCRIPT> tag pairs are located in the HTML
document.
- C - When would you not use a JavaScript source file?
when the JavaScript code is fairly
short and is not shared
- D - HTML document can contain both JavaScript code and JavaScript
source files.
- C - You create line comment in JavaScript code by adding //
to a line you want to use as a comment.
- A - Block comments begin with /* and end with */.
- D - You hide JavaScript code from incompatible browsers by using HTML
comment tags.
- A - You display alternate text to users of incompatible browsers by using
the <NOSCRIPT>...</NOSCRIPT> tag pair.
- D - How are JavaScript code sections executed in HTML document?
Each JavaScript code section is executed in
the order in which it appears.
- B - JavaScript can be placed in either the <HEAD> or
<BODY> sections of an HTML document.