SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Apr 3, 2001, 14:54 #1
- Join Date
- Dec 2000
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Here's one of those things that's probably really simply once you do it once, but, unfortunately I haven't yet. I was wondering if any of you gurus could give me a minute.
I've seen sites where you can only have a certain number of pop up windows open at once.
In other words if you click on one while another is open, it pops in the same window as the first did.
Any advice would be greatly appreciated.
peace
-
Apr 3, 2001, 16:05 #2
- Join Date
- Feb 2001
- Location
- Van down by the river
- Posts
- 254
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Use this function in the head of your page to open the new window:
<script language="JavaScript">
<!--
function openWindow() {
popupWin = window.open('anotherPage.html', 'myWin', 'scrollbars,resizable,width=640,height=480')
}
// -->
Call your script from a link in the body:
<a href="#" onClick="openWindow();">Open Window</a>
Then in the page that opens in the popup window, use this to always bring it to the front when a link is clicked in the parent window:
<script language="JavaScript">
<!--
window.focus();
// -->
</script>
Since you've given your window a name in the function that opens the window (myWin) and used the window.focus() in it, it should do the trick. To get really fancy, you could pass the function the name of your new window, so that you could control more than 1 popup window - but I won't go into that now - plus the more popups you have, the more annoyed the user will be.
P.S. Check out http://www.builder.com/Programming/S...97/toolwb.html for a good tool to build your popup window.
-
Apr 4, 2001, 06:21 #3
- Join Date
- Dec 2000
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
much thanks Scrubz! I'll check it out this afternoon.
Bookmarks