jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes target = Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "target ="_BLANK" from java" Watch "target ="_BLANK" from java" New topic
Author

target ="_BLANK" from java

lindsay smith
Greenhorn

Joined: Dec 28, 2004
Posts: 6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
The line in your js function
function goTo() {document.location.href = add;}

needs to be

function goTo() {newWindow = window.open(add);}
lindsay smith
Greenhorn

Joined: Dec 28, 2004
Posts: 6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
opening it in the same window is the orginal way it was done...
lindsay smith
Greenhorn

Joined: Dec 28, 2004
Posts: 6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
ahhh

parent.frameName.document.location.href = add;
lindsay smith
Greenhorn

Joined: Dec 28, 2004
Posts: 6
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: target ="_BLANK" from java