Pages

Sunday, October 31, 2010

Pop-Up Window

____________________________________________________________________________

<a href="#" onClick="MyWindow=window.open('window.html','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=400,height=300,left=200,top=100'); return false;">Click for Pop-Up</a>
____________________________________________________________________________
Here is an example: Click for Pop-Up.
This is what the different variables of the code mean, and how you can customize them:

window.html the URL of the page you wish to pop up.
MyWindow the name you'd like to give to the pop-up window.
toolbar=no set to 'yes' if you'd like the window to have a toolbar.
location=no set to 'yes' if you'd like the window to have a location box.
directories=no set to 'yes' if you'd like the window to have a toolbar.
status=yes set to 'no' if you'd like the window to have no status bar.
menubar=no set to 'yes' if you'd like the window to have a menubar.
scrollbars=yes set to 'no' if you'd like the window to have no scrollbars.
resizable=no set to 'yes' if you'd like the window to be resizable.
width=400 the width in pixels of the window.
height=300 the height in pixels of the window.
left=200 the distance of the window from the left of the screen.
top=100 the distance of the window from the top of the screen.

You can have as many pop-up window links as you like on the same page, just be sure to give every one a different name.
To have a "Close Window" link as in the example above, use the following code:
<a href="javascript:self.close();">Close Window</a>

0 Comments:

Post a Comment