Javascript : Client Side Scripting ::Window Object
- Window Object?
- Properties and methods with windows
- setTimeout and setInterval method
- Managing History with Window
- Document Object Properties
Window Object? |
Properties and methods with windows |
Properties
- closed
- defaultstatus
- status
- frame
- location
- name
- self, window
- parent
Methods
- alert( message)
- prompt( message, default_text )
- confirm( message )
- blur()
- focus()
- close()
- open(url, window name)
setTimeout and setInterval method |
Window Object – Timeout and Time Interval
setInterval() methods preforms specified job repeatedly after specified time-interval
setInterval('alert("4 seconds over")',4000)
displays alert dialog box after every 4 seconds, for an infinite number of times. This returns interval reference to a variable.
ref = setInterval("myfunc()", 4000)
To terminate clearInterval() method can be used as, clearInterval(ref).
setTimeout() methods performs specified job once only after specified time-interval.
ref = setTimeout("myfunc()", 4000)
it will call myfunc() after 4 seconds for once only.
Managing History with Window |
Managing History:
- Back() – Load the previous URL in the history list.
- Forward() – Load the next URL in the history list.
- Length – Length of history list.
- Go() – Loads an URL, specified by an offset from the current place in the history list.
Example:
Window.history.back()
Window.history.go(-1)
Window.history.forward()
Window.history.go(1)
Document Object Properties |
Document Object Properties
- Forms[] :- An array of form objects, one for each <FORM> and </FORM> in the document. The number of forms in the document can be determined using the statement forms.length.
- Images[] :- An array of image objects, one for each embedded image. The number of images can be determined using images.length statement.
- links[] :- An array of link objects, one for each hypertext link (<A HREF>) in the document. The number of link objects can be determined using links.length statement.
Other Properties
- lastModified :- A string contains date of the most recent changes made to the web document.
- referrer :- A string (read-only) that contains the URL that contained the link to the present document.
- title :- A string (read-only) that contains the title of the document.
- URL :- The URL of the document
- domain :- The domain name of the server from which the document is loaded
Recent Comments