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
Thanks in advance.