Frame Object
The frame object is a browser object of JavaScript used for accessing HTML frames. The user can use the frames array to access all frames within a window. Using the indexing concept, users can access the frames array.
- The frames array index always starts with zero and not 1.
- The frame object is actually a child of the window object. These objects are created automatically by the browser and help users to control the loading and accessing of frames.
- The properties and methods of frame object are similar to that of Window object in JavaScript.
- The frame object does not support close() method that is supported by the window object.
- Using the <FRAMESET> document creates frame objects and each frame created is thus a property of the window object.
Frame Properties
- frames
- name
- length
- parent
- self
frames:
The frame property of the frame object denotes a collection or array of frames in the window and also in the frameset.
self:
As the name implies, the self property of the frame object denotes the current object. by using self-property the user can access the property of the same object.
name:
The name of the frame object denotes the name of the object. The method of denoting the name attribute is performed by using the name attribute of the <frame>tag.
length:
The frames array has all the frames present within a window and the length property of the frame object denotes the length of the frames array or gives the number of frames present in a window or a frames array.
parent:
As the name implies, the parent property of the frame object denotes the parent frame of the current frame.
Methods of frame object:
- blur()
- focus()
- setInterval()
- clearInterval()
- setTimeout(expression, milliseconds)
- clearTimeout(timeout)
blur():
blur() method of frame object removes focus from the object.
focus():
focus() method of frame object gives focus to the object.
setInterval():
setInterval() method of frame object is used to call a function of JavaScript or to evaluate an expression after the time interval specified in arguments has expired. The time interval in arguments is always specified in milliseconds.
clearInterval():
clearInterval method of frame object is used to cancel the corresponding definedsetInterval method. This is written by referencing the setInterval method using its ID or variable.
setTimeout(expression, milliseconds):
setTimeout method of frame object can be used to execute any function or access any method or property after a specified time interval given to this method as an argument.
clearTimeout():
clearTimeout method of frame object is used to clear a specified setTimeoutmethod. This is written by referencing the setTimeout method using its ID or variable.
إرسال تعليق