når man åbner et vindue, kan man det et navn.. et ved navn=window.open.. eller window.open("adressen", "navn")..
her er et script der burde virker.. men jeg kan ikke fået det til det:
http://www.designf1.webcentral.com.au/tutorials/jswin002_ws.html--- udsnit af det på url:
Call the Popup Function
Now we want to call the function with the appropriate page inserted into the popup. You can call any webpage you like - just replace the argument page with a real url. Using an <A> element, we do this:
<a href="java script: genericPopup('mypopup.html')">Click here</a>
How does this work? The value mypopup.html becomes the value of the argument called page in the original genericPopup(page) function. In other words, mypopup.html is passed to the function. It is then passed to the url parameter of the window.open() method. The end result is a generic popup function.
Managing the Popup
When a popup is activated, you need some way of making sure that, if the user clicks the same link for the popup, the user doesn't get multiple instances of the same popup crowding out the taskbar. It annoys the user (understanably so) when they have to close half a dozen windows at the end of a session.
Fortunately, there is an easy way to make sure this doesn't happen by checking to see if the popup is open or not. If the popup is open, then we give it focus so it sits on top of the main browser window. If it isn't already open, then we open the popup. The script looks like this:
var popupWin
function genericPopup(page){
if(!popupWin || popupWin.closed){
popupWin=window.open(page,'','width=300,height=300');
} else {
popupWin.focus()
}
}
Stepping through the script, we declare a global variable called popupWin that we will use to check if the popup is open closed, as we have done starting at the third line. This statement says if popupWin is not open (!popupWin) or (||) if popupWin is closed (popupWin.closed), then popupWin equals the window.open() method, so go ahead and open an instance of the popup.
If the window is already open (else), then bring that window to the front of all other browser windows (popupWin.focus()).
The popup is called the same way as mentioned previously.
---