|opening new window||closing new window||creating full window|
|closing main window||scrolling up window||Browser checking|
|Page forwading||Popup window examples||Shaking window|
|Creating /Opening a new window|
Q: How do I open a new browser window?
A: By using the window.open() method, you can open a new browser window.The following script opens a new window named Window1 and loads window3.htm page.
We can control the following properties of new window.
width =number of pixels
height =number of pixels
directories = yes|no
location = yes|noTop
By using the window.close() method, you can close browser window.Since you want to close the newley created window follow the 2 steps.
1)Store the return value in the variable (in the above example ‘NewWin’)as a reference to your new window.
2)Use this reference to close this window (NewWin.close()). Following is the Javascrit example for closing the newly created window. After opening the new window, use ‘close new window’
button to close the new window.
Opening full windows
Open a new window in full screen mode. Menu bars and the status bar are disabled. To close this newly created window click Alt+F4
Closing the main window.
Following is the script for closing the main window.
Scrolling up window contents How it works ?
The object window has a property to scroll a page up or scroll down by x lines. For IE, this property can be accessed by
window.body.scrollTop. For Netscape, the scrolling position can be accessed by window.pageYOffset.Here’s the logic behind the scroll:
1> ScrollWindowContents() is the function which does the scrolling. A timer is set to call the ScrollWindowContents() function repeatedly :
2> Have a boolean variable ToggleVariable which toggles between 1 and 0. Also, keep 2 variables ScrollPosition1 and ScrollPosition2 that will keep track of window’s current scroll position3> Keep track of window’s scroll position
For IE : window.body.scrollTop
For Netscape : window.pageYOffset.4> Increment window’s scroll position by adding 1 and assign it to either ScrollPosition1 or ScrollPosition2 depending on the toggle variable. When end of page is reached, both ScrollPosition1 and ScrollPosition2 will be having same values. At this point, reset scroll position to 0 , which will bring back to top of the page.
Complete Source Code:
Page contents: itechies.net – Windows