Browser Objects and Built-in Objects
JavaScript organizes all the objects in a Web page in a hierarchy. Six built in browser objects are available and they can be used in any scripting language and three built-in objects.
Browser Objects:
Window
Document
Form
Navigator
History
Location
Built-in Objects:
String
Math
Date
Window Object :
The window object is the top level object in the object model. It contains all other objects except the navigator object, which is not tied to any particular window.
Properties:-
default status – The default message in the status bar
frames - An array that describes all the frames in the window
length - Reflects the number of frames in a window
name - Name of the window
status - Values that appear in the window's status bar, usually last for a moment before being overwritten by some other event.
Method:
alert : Bring up alert dialog box in which we can display the data
close : Closes the window
confirm : Bring up a dialog box with yes or no buttons and a user specified
message
open : opens a new window
prompt : Brings up a window with user specified text and an
input box that allows the user to type information
Document Object :
The document object is very useful because it contains a lot of information about the current document.
Properties :
alinkcolor : reflects ALINK attribute of tag
anchors : array listing of all the html anchors
anchor : an anchor object
bgcolor : used to set the background color of document
fgcolor : used to set foreground color (text color) of the document
history : The object containing current browser's history
linecolor : default color setting for all the links
vlinkcolor: used to set the color of the links that have been visited
Methods :
clear ; Clears the window of all its content
close : close the open document
open : opens a new document
write ; writes some expression to current window
writeln : writes some expression to current window and write a new line character at the end
Form Object:
The Form object is created every time Javascript encounters a in the HTML document. It contains all the information about the form
as well as it can be used to submit information to the server.
Properties:
action : reflects the html action attribute of the
No comments:
Post a Comment