Student Menu. © Lesson 3. Printable layout. Links won't function in print.

 

Notes Section

Main Text


Module 3.0


The programming exercise will be much easier if you read and outline your textbook first.

 

Read Course Text.


Please read and outline section J 2.18 to J 2.60 of your textbook. Pay particular attention to the numbered orange dots representing each step, the "More About" side comments, the tan boxes containing code, the tables and the figures.

 

Module 3.1

Part of the JavaScript Object Hierarchy



                                                                                                     
Window
                                                                                |
                                                                                |
                             Document---------- Frame---------- Location---------- Navigator
                                     |                                                                                        |
                                     |                                                                                        |
      anchor----- form----- image----- link                                         appName----- appVersion

 

Note: Above, the objects appear in bold and their properties appear in italics.

JavaScript objects can be confusing, because some objects are properties of other objects. For example, some properties of the Window object like document, frame and location are also objects in their own right.

 

Module 3.2


Some Window Object Properties:

window, self, parent, top, history, location, status

Some Window Object Methods:
alert( ), confirm( ), prompt( ), open( ), close( ), setTimeOut( )

 

Window Object.

Represents the browser window. It is the top-most, global object and assumed in many statements.

 

document.write("Hello!")  could be  window.document.write("Hello!")

window.alert( )  is a method of the Window object. Due to the object's global nature, the method could be used like a function, simply  alert( ) 

Examples:

1. location = "www.cnn.com"  links to a new site.

2. open("webpage.htm", "window1", "toolbar = no")  opens another window.

3. setTimeOut("Scroller( )", 200)  executes Scroller( ) function after 200 milliseconds.

 

Module 3.3

Some Document Object Properties:

fgColor, image, cookie, link, lastModified 

Some
Document Object Methods:
write( ), clear( ), writeln( )

 

 

Document Object.

Represents the HTML document displayed in the browser. The Document object's properties provide may details about a web page's text and background colors as well as the date last modified. The write( ) method of the Document object is especially useful for dynamically writing HTML to the web page when it's loading.

Examples:

1. document.fgColor = "yellow"  changes the foreground color to yellow.

2. var CookieInfo = document.cookie  assigns the information stored in a cookie text file to a variable called CookieInfo.

3. document.write("Last Modified: " + document.lastModified)   displays the date last modified using the write( ) method.

 

Module 3.4


Some Navigator Object Properties:

appName, platform, appVersion

Some
Navigator Object Methods:
javaEnabled( ), preference( )

 

Navigator Object.


Determines which web browser is used to visit the web page. May be used to direct the user to a customized, browser-specific, web page.

Examples:

1. var BrowserName = navigator.appName  assigns the browser's name (Netscape or Microsoft Internet Explorer) to a variable called BrowserName.

2. var BrowserVersion = navigator.appVersion  assigns the browser's version () to a variable called BrowserVersion.

 

Module 3.5

Detailed Document Object Hierarchy





Image from developer.netscape.com/docs/manuals/communicator/jsguide4/navobj.htm of the JavaScript Guide. Please review that web page carefully.

When first learning HTML, it may feel quite overwhelming to keep track of all the different HTML tags (like <BODY>), their attributes (like BGCOLOR) and those attributes' properties (like BGCOLOR="yellow").

Similarly, when learning Object Oriented Programming (OOP), especially JavaScript whose objects may sometimes be properties of other objects, it may appear confusing and complicated.

However, just as HTML may be mastered given enough time and practice, so to may JavaScript be learned given an earnest effort at paraphrasing the material, a dedication to investing the time and practice, practice, practice! J

 

Module 3.6

 

Exercise 3.


  1. It cannot be understated the importance of outlining, paraphrasing and taking notes on materials presented so far in the course.
  2. Try to find, modify or create your own code examples for each type of control statement. Build a code achieve that can be shared or trade with colleagues.
  3. Visit all the links shown on this lesson and define any new vocabulary terms in the JScript (JavaScript) Language Reference.
  4. Take notes on this weeks materials and paraphrase it in your own words. Discuss the correct answers to this week’s quiz (shown below) in the discussion board. You'll have several opportunities to change your answers to the quiz before it's graded.
  5. Open this script (see Announcements page) in your browser, copy and paste the text into NotePad and save the file as FormValidCalculate.htm. What happens and why?
  6. Note: Lesson Four will simply review the JavaScripts presented in this course. It has no exercise and its quiz is shown below.

 

 

Module 3.7

 

Quiz 3.

 

  1. What is an argument?
  2. What is a parameter?
  3. Who is ECMA?
  4. Which object is automatically assumed and need not be typed?
  5. An object is described by its what?

 

 

Module 3.8

 

Quiz 4. (For those wanting to finish the course early.)

 

  1. What is the top-most or global object in the JavaScript object hierarchy?
  2. Identify Branching, Looping and Jumping Control Statements.
  3. JavaScript objects and be confusing because some objects are  ________ of other objects. 
  4. Describe Data Types, Variables, Expressions, Operators and Arrays.
  5. Curly Braces { } are used to hold ________ within the body of a Function.