|
JavaScript
Javascript has many built-in features which enables us
to manipulate web pages:
User- and browsermade variables
Variables can be "born" in two different ways in javascript:
- we create it or
- the browser creates it automatically
For us the last will be important: whenever a page gets
downloaded javascript creates several variables. The purpose of this
is to make the html page accessible form javascript.
Javascript enabled browsers create variables for each
image, form, link, etc. that is defined in the html code. Later these
variable get readable and some writeable too.
So the next happens autommatically (without manual or
programmatical interference) ie. a task of the browser:
~ creation of certain variables
~ the possible syncronisation (ie. if we update a variable assigned
to a html tag obviously the change must be done in the monitor too -
the display must also be refreshed)
Hierarchycal structure...
The automatically made variables get into a pre-defined (independent
form the current html doc) object structure. This structure - just as
in many other cases - has a hierarchical structure and brings up several
reserved words.
Important variables
window contains information about the browser window
document contains information about the current html document
images contains information about the images in the document
links contains information about links in the document
forms contains information about forms in the document
Table2. Important variables
window
In the top there's the window variable (object) which contains every
info that is related to the current window.
Comment: when you make a new variable within javascript
then usually you do nothing but extends this window object...
document
Below window there is the document variable. This contains datas related
to the currently dowloaded page but doesn't contain the window-related
datas (like as window height, width, toolbar, etc.)
images
Below document variable automatically becomes into being a so called
images array, that contains infos about images ( <IMG> ) of the
html-document.
links
Below document variable automatically becomes into being a so called
links array, that contains infos about links ( <A HREF> ) of the
html-document.
forms
Below document variable automatically becomes into being a so called
forms array, that contains infos about forms ( <FORM> ) of the
html-document.
Page 2
|