Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-19-2004, 10:56 PM   PM User | #1
meeble
New to the CF scene

 
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
meeble is an unknown quantity at this point
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..
meeble is offline   Reply With Quote
Old 10-20-2004, 02:51 AM   PM User | #2
meeble
New to the CF scene

 
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
meeble is an unknown quantity at this point
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
meeble is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:38 PM.


Advertisement
Log in to turn off these ads.