Lesson 6: Advanced Features



Array Object
New arrays are created with the Array() constructor, which may take a positive integer to set length of array but is not required.
Properties

length=length of array
Methods

join(Character)= returns string made up of all array values, values separated by the character specified in parenthesis
reverse()= reverses array index
Example Properties

Example Methods




images[] array
Object, property of the docuemnt object. Array created as index of all images HTML img src tag marks up. Background image is NOT indexed. Only property most browsers allow changes is src.
Properties

border = image border in pixels
height= image height in pixels
hspace = image horizontal setting in pixels
name= set with HTML name attribute in img tag
src=URl of image source
vspace=image vertical padding in pixels
width= image width in pixels



External Files
Several web pages on a site may require the same JavaScript function or code. Rather than have to type the same code in for every page, the code can be saved in a text file with the file extension ".js". The ".js" file contains only the actual JavaScript code, without the <script language=JavaScript> </script> HTML tags.

To access the external file on the web page, the <script language=JavaScript> </script> HTML tags are slightly changed by the addtion of an additional attribute:

<script language=JavaScript src="filename.js"> </script> HTML tag

The browser will read the web page and external file, executing the code as if the JavaScript inside the external file was part of the web page.

Return to main page