PDA

View Full Version : Help with Javascript popup


videotoys
03-04-2006, 07:55 PM
So I have a popup that opens a window but if the popup is already open it stays behind the parent window and Im trying to figure out how to make it come to the front whether theres a window that already used that script open or not.

Heres the script I use:

<!--hide

function newwindow()
{
window.open('guide.html','guide','scrollbars,resizable,status,width=800,height=600,top=100,left=500' );
}
//-->
</SCRIPT>

Need an example to see what Im talking about heres the site Im working on:

http://www.musicchannel1.com/index.shtml

Now if you click on the popup guide but then leave it open and go back to the parent window then you click say on the "Top 25 Music Videos" link the guide opens but its needs to come to the front if there is a guide already open, hope that all makes sense and someone can help, Thanks in advance.

Vege
03-05-2006, 09:30 AM
Basically dont use javascript popups cos people just block them.

Sry about flaming, but thats how it is.

videotoys
03-05-2006, 01:39 PM
actually if people are blockin them then they can unblock them if they trust the site and I try and have buttons that tell people its a popup, havent heard any complaints yet and we get about 8000 viistors a week, anyway, I was actually able to find a fix, I had to add a focus() to the script so this is what the final codes looks like this:

<SCRIPT type="text/javascript" language="JavaScript">
<!--hide
var newwindow;
function newwindow()
{
newwindow=window.open('guide.html','guide','scrollbars,resizable,status,width=800,height=600,top=100 ,left=500');
if (window.focus) {newwindow.focus()}
}
//-->

</SCRIPT>