1

Topic: Javascript Junkies Please Help!

Im having a bit of a problem with remote links in a pop-up window. On my site I have a link that brings up a pop-up for the main sites content which has links in it that I would like to have react in the initial page. I have done this with the following code:

code for index.html

// OPENS REMOTE WINDOW
<script>
<!--
function openWindow(myLink,windowName)
{
if(! window.focus)return;
var myWin=window.open("",windowName,"height=450,width=680,dependent=yes,scrollbars=yes");
myWin.focus();
myLink.target=windowName;
}
//-->
</script>

// CONTROLS REACTION
<script>
<!--
function remote(){
win2.creator=self
}
//-->
</script>

// LINK TO OPEN POPUP
<a href="popup.html" onClick="openWindow(this,'mainpage')">CLICK HERE TO OPEN THE POPUP!</a>

and

code for popup.html

<script>
<!--
// REMOTE CONTROL LINKS
function remote2(url){
window.opener.location=url
}
//-->
</script>

// LINK IN POPUP.HTML THAT WILL REACT IN INDEX.HTML
<a href="javascript:remote2('forum.html')">Forum</a>

What I would like to have done is when the user clickes on a link in the pop-up that reacts in the main window (index.html) I would like that window to be in focus. As it stands now I'v got the links to work properly but it just loads in the background and the popup remains ontop blocking the under lying content (punbb). My problem is I dont know how to use the javascript function onfocus well enough for it to work. Unless I'm over looking an easier way...

I hope I gave enough information so that one of you javascript junkies can help me out smile

Thanks in advance.

-gezz

Re: Javascript Junkies Please Help!

Moving, nothing to do with PunBB

3

Re: Javascript Junkies Please Help!

should be pretty easy...

function remote2 (url) {
    window.opener.location = url;
    window.opener.focus();
}

4

Re: Javascript Junkies Please Help!

God damn cross browser-ness...

It works fine in IE 6, but not in firefox.

Is there a better way to do this? Maybe through php? Not with javascript?

Thanks for the help thus far.

-gezz

5

Re: Javascript Junkies Please Help!

Okay, I was told by a friend that what I wanted could be done through php does anyone know what it would look like?

-gezz

Re: Javascript Junkies Please Help!

I don't think so, php is a server side language it can't do anything on the users computer, why not ask your friend how if they know?

7

Re: Javascript Junkies Please Help!

Well I guess it isnt possible then. Seems like he was talking out of his ass to he honest saying that it was possible when he had no idea how it would be possible.

Connorhd: Is there another way I could get the same effect without using javascript?

-gezz