FORUMS: list search recent posts

Easy way to change "target" label fo current window?

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bret WilliamsEasy way to change "target" label fo current window?
by on May 9, 2005 at 4:51:24 pm

Is there a simple way to change the target name of a curent window. I know I can open a new window and give it a name so that I can have other content open in that particular window, but within the new window, I'd like to have some links that open back up in the previous window, but the previous window doesn't have a name. Any way to make that happen?


Return to posts index

Curtis ThompsonRe: Easy way to change "target" label fo current window?
by on May 9, 2005 at 5:01:13 pm

hello...

if you're trying to change the url of the window that opened the new windows (from the new windows), then you can either use "opener" - so like opener.location.href = 'whatever';

sitruc


Return to posts index

Bret WilliamsRe: Easy way to change "target" label fo current window?
by on May 9, 2005 at 10:09:21 pm

No, I can rename the source (opener) windows the first time someone visits the site. So I guess that would mean putting some code on every page.

I want to be able to open a window, and the links in that window open back in the previous window. Sounds like what you have is the best thing, since I only have 2 sections that do this.

Where would that code go, in the tag?


Return to posts index


Curtis ThompsonRe: Easy way to change "target" label fo current window?
by on May 9, 2005 at 10:25:31 pm

hello...

ya - in the popup window, make the href link something like:

<A HREF=javascript:opener.location.href='something'">link</A>

and then something can be whatever you want it to be url wise - even more robust is a nice window closer as well:

<A HREF=javascript:changeParent('something')">link</A>

and then have a js function with that name:

function changeParent (url) {
opener.location.href = url;
self.close();
}


and then it will change the parent to the url and close itself in one click...

sitruc



Return to posts index

Bret WilliamsRe: Easy way to change "target" label fo current window?
by on May 9, 2005 at 10:38:01 pm

If something is the name of the target window, and link is the link text, where does the actual file path go?


Return to posts index

Curtis ThompsonRe: Easy way to change "target" label fo current window?
by on May 9, 2005 at 10:47:55 pm

hello...

no - sorry..."something" is the url. you reference the window that opened the current window via the opener modifier in opener.location.href...javascript stores the window that opened a window (via javascript) in that parameter...

sitruc


Return to posts index


Bret WilliamsRe: Easy way to change "target" label fo current window?
by on May 9, 2005 at 10:54:48 pm

Can I assume you messed up the quotes in the previous post? That's what's got me stumped here now...


Return to posts index

Curtis ThompsonRe: Easy way to change "target" label fo current window?
by on May 9, 2005 at 11:04:41 pm

hello...

let's just avoid the runaround - here's an example of what i'm talking about...

http://sitruc.com/cow/parent_change/page.html

is that what you had in mind?

sitruc


Return to posts index

Bret WilliamsRe: Easy way to change "target" label fo current window?
by on May 9, 2005 at 11:29:12 pm

Thanks as always! Finally got it. I was trying to figure out syntax inbetween your emails. You were missing a double quote. But I also had added the script bit into the wrong .js file. So even when I got the syntax right it was just dead. User error of course.

So I've got a test running hownet.lunarpages.net/store/wirelesswaysretail.php

If you click on the "read" link on the right, it opens a window to read the book. Then if you click on the "wireless ways" title link, it should close and go back. Even if you've surfed around in the main window. That's exactly what I was trying to do.

We were going to opt for a flashpaper version of this book, but we opted for this more laborious version. :) It's still a work in progress. I'm just working on the navigation and cutting and pasting from his old, 6 year old site, and using pointless photos as placeholders and stuff.

There's a lot of crazy includes, iframes, and now little bits of javascript going on.


Return to posts index


Curtis ThompsonRe: Easy way to change "target" label fo current window?
by on May 10, 2005 at 12:26:08 am

cool - glad it worked! sorry for the typo...that's not much help... :-/



Return to posts index

Bret WilliamsRe: Easy way to change "target" label fo current window?
by on May 10, 2005 at 12:31:24 am

I figured it out, but was second guessing myself because I had linked to the wrong js file! Doh.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]