Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript opener.focus() not working?

    Hello,

    Just so you can see what I'm working on here's the URL:

    http://dev1.usachurch.com/

    (username: staff / password: staffpw)

    If you look half way down, you'll see the tan text ads. When clicked, javascript is being used to open up a new window (named "adwindow"). here's the JS code:

    Code:
    function adWin(adid,url,title){
    adWindow = window.open('adWindow.jsp'+'?adid='+adid+'&ad_url='+url+'&title='+title,'adwindow');
    adWindow.focus();
    return false;}
    the adWindow.jsp page handles the click counts in the stats DB, and the opens up 2 frames - the top small frame with the USAChurch image (named "header"), the bottom main frame (named "main"). the top header's src is adHeader.jsp, and this is where the problem is. I'm trying to simply focus back on the main window with a "opener.focus()" inside of a function, but its just not working (when clicking on the USAChurch image). Am I missing something obvious? I'm guessing the frames are breaking it. Here's the code in adHeader.jsp:

    Code:
    <script language=JavaScript1.2>
    function goback(){
    opener.focus();
    return false;}
    </script>
    
    <a href="http://www.usachurch.com/" target="_blank" onClick="javascript:goback();return false;">
    <img src=/i/adlink.gif width=114 height=30 border=0></a>
    Thanks,
    meeble

    UPDATE: I moved the goback() JS code from the adHeader.jsp (top frame) page to the adWindow.jsp (frameset) page and it now works on Safari on Mac, but still not on IE or Netscape on Windows...
    Last edited by meeble; 10-19-2004 at 11:21 PM.

  • #2
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    fixed - almost!

    Hello,

    well, I've almost figured this out. The JS code in the adHeader.jsp page needed to be changed from
    opener.focus();
    to
    top.parent.opener.focus();

    which seems to work on every browser I've tried it on...

    so,

    besides the fact that the basic functionality is working now, one of the text ads seems to get caught in a loop occasionally. (reloading over and over...) The left text ad for Compassion seems to be slightly allergic to my code? I never get the loop thing with the Dave Ramsey ad. Could it be the way I have set up the frames?

    thanks,
    meeble


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •