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:

  1. C - Hypertext Transfer Protocol manages the hypertext links that are used to navigate the Web.
  2. C - Every document has a unique address known as a Uniform Resource Locator.
  3. D - A domain name identifies one or more IP addresses.
  4. C - HTML elements may contain an ending tag, depending on the HTML element.
  5. C - The Web browser process of assembling and formatting an HTML document is called parsing or rendering.
  6. B - HTML is not case-sensitive.
  7. C - HTML attributes are placed within before the closing bracket of the starting tag.
  8. C - HTML documents start and end with the <HTML>...</HTML> tag pairs.
  9. B - What is the correct syntax for a non-braking space code? &nbsp;
  10. A, B, and C - Which of the following can be used for creating HTML documents?
    1. A text editor
    2. A word-processing program capable of creating simple text files
    3. An HTML editing program
    4. A Web browser
  11. C - The rules of a programming language are known as its syntax.
  12. A - The term scripting language refers to programming languages that are executed by an interpreter from within a Web-browser.
  13. C - The most recent version of ECMAScript is Edition 3.
  14. D - Execute the various statements and procedures of a program in the correct order to produce the desired results is called logic.
  15. B - The term machine language is used to refer to interpreted languages that run from within a Web browsers.
  16. 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:

  1. B - Scripting code in an HTML document is located between the <SCRIPT>...</SCRIPT> tag pairs.
  2. C - The <SCRIPT> tag can be used with both JavaScript and VBScript.
  3. D - Which of the following is not valid with the LANGUAGE attribute of the <SCRIPT> tag? JavaScript 1.2
  4. 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.
  5. 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.
  6. D - An object refers to programming code and data that can be treated as an individual unit or component.
  7. A - The JavaScript object that represents the content of a browser's window is called the Document object.
  8. B - With JavaScript, new text is created on a Web page using the write() method or the writeln() method.
  9. D - Which of the following is the correct syntax for including a quoted string within a literal string?
           "this is a 'quoted' string"
  10. D - The <PRE>...</PRE> tag pair tells a Web browser that any text and line breaks it contains are to be rendered as is.
  11. C - Which of the following statements is correct?
           document.write("Hello World")
  12. D - A JavaScript source file is called using the SRC attribute of the <SCRIPT> tag.
  13. B - JavaScript source files cannot include HTML tags.
  14. A - When an HTML document calls a JavaScript source file, the <SCRIPT>...</SCRIPT> tag pairs are located in the HTML document.
  15. C - When would you not use a JavaScript source file?
           when the JavaScript code is fairly short and is not shared
  16. D - HTML document can contain both JavaScript code and JavaScript source files.
  17. C - You create line comment in JavaScript code by adding // to a line you want to use as a comment.
  18. A - Block comments begin with /* and end with */.
  19. D - You hide JavaScript code from incompatible browsers by using HTML comment tags.
  20. A - You display alternate text to users of incompatible browsers by using the <NOSCRIPT>...</NOSCRIPT> tag pair.
  21. D - How are JavaScript code sections executed in HTML document?
          Each JavaScript code section is executed in the order in which it appears.
  22. B - JavaScript can be placed in either the <HEAD> or <BODY> sections of an HTML document.