Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

target ="_BLANK" from java

 
lindsay smith
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'day all,
Hope I have the correct forum.
I'm using the following code (banner.js) to rotate banner ads from a frame. However I'd like to open them in a new window (_blank) or (_parent).

Can some kind soul help point me in the right direction please.
Thanking in advance,
build

http://members.datafast.net.au/~build/banner.js

[ December 28, 2004: Message edited by: lindsay smith ]
[ December 28, 2004: Message edited by: lindsay smith ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The line in your js function
function goTo() {document.location.href = add;}

needs to be

function goTo() {newWindow = window.open(add);}
 
lindsay smith
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'day Eric,
Thank you Eric that works well.

Can I push my luck and ask how I would open in the _Parent window?

Thanks in advance
build
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
opening it in the same window is the orginal way it was done...
 
lindsay smith
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'day Eric,
The page has 2 frames, a header frame and a main frame. The link images are in the header frame. The original code opens the link in the header frame. If I was using straight html I'd use "target=_parent" in the "A" tag. Is this possible in the banner.js script?

Again, Thank you for your time!
build
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahhh

parent.frameName.document.location.href = add;
 
lindsay smith
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'day Eric,
Once again, thank you.

Unfortunatly it does not seem to work. I'm probably implimenting it wrongly. The code is here:
http://members.datafast.net.au/~build/banner.js

any suggestions?

again, tia,
build

btw, thx 4 link to book, I've ordered a copy from local bookshop.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic