Search

Monday, April 6, 2015
0 comments

Object properties and Methods in Java Script

2:45 AMMonday, April 6, 2015
These objects all have particular properties and methods that are associated with their respective objects and they can be accessed and manipulated. A property of an object is a predefined variable that you can assign a value to with simple dot notation syntax like this:

objectNamePropertyName = value

For instance, if you want to change background color of document object to yellow, you would access the bgColor property and assign the String “yellow” to it like this:

Document.bgcolor=”yellow”

A Method of an Object is just a predefined function that has already been assigned to an Object by Netscape. You invoke a Method on an Object with same dot notation like this.

objectName.methodName( )

Window Object is the parent object of all other objects In a page, which means it’s at the top of the hierarchy of all page content, including those that have FRAMESETs and FRAMEs. All other objects are its descendants or child objects. Some of the child objects like the document object are also parent or container objects for other objects that are lower down in the hierarchy. All child objects are said to be properties of their respective parent objects and such they can be manipulated and referenced with java script.
Suppose you want to give focus to window at some point in script. You do that by referencing the window object and calling the focus( ) method like this

Window.focus( );

Window object is always the parent object, Netscape allows you to omit it from expression that invoke other objects, since it is always assumed to be there.

Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top