|
|
HTML (Javascript) Popup
The easiest way to create a popup is using the anchor html tag (<a href="">). There are two spots in the tag that you can use for a popup, depending on the situation you have. In both cases we will use javascript window object with method open.
<a href="javascript: var a=window.open('url1','windowname','properties');">First Popup</a>
This is the simplest popup, when user clicks on a link new windo pops up with defined url1 and properties. Current window content do not change.
<a href="url1" onclick="var a=window.open('url2','windowname','properties');">Second Popup</a>
This is little beet more sophisticated, when user follows the link, he gets new popup with defined url2 and properties, but at the same time content of the current window changes to url1. If you want to have the same functionality as in the first popup, you can modify code a little:
<a href="url1" onclick="var a=window.open('url2','windowname','properties');return false;">Second Popup</a>
In this case it does not matter what url1 is, user will only get a popup with url2, content of the current user window will not be changed.
Many people ask how to create popup in the back (it become very popular nowdays), this way user is not distructed that much. We will use the same method, just will add some details for the window focusing:
<a href="javascript: var win_one=window.open('url1','windowname','properties');win_one.blur();window.focus();">Popup In the Back</a>
References:
URL - this is a string containing the URL of the document to open in the new window. If no URL is specified, an empty window will be created.
WINDOWNAME - this is a string containing the name of the new window. This can be used as the 'target' attribute of a |
|