JS: one frame tells another to jump to anchor

by Complex <complex_hwg(at)yahoo.com>

 Date:  Tue, 9 Jan 2001 11:00:51 -0800 (PST)
 To:  Languages HWG <hwg-languages(at)hwg.org>
  todo: View Thread, Original
I can't wait for this Intro JavaScript class to finish. :-) I'm trying
to cobble together enough simple code to do this:

I have a two-frame frameset. I want the "Back to Top" link in the left
frame (name="nav") to tell the right-hand frame (name="main") to go to
an anchor (anchor's name: "Super-page_top"). Sounds simple...

I took one look at Adobe GoLive 4's ready-to-go scripts and decided I'd
rather code my own. That's nothing new.

I tried this: The link in the left frame is:

<a
href='javascript:parent.main.location.replace(parent.main.location.pathname
+ "#Super-page_top");' title="blah" onmouseover='window.status="blah";
return true;'>
Go to top
</a>

Problems:

1) When I open the local (hard drive) copy of my site, 
scroll down or follow a link to an anchor lower on the page, 
and click this link, 
1a) the main frame jumps to the top as it should, but
1b) the nav frame displays the text of the _old_ location of the main
frame. If I had followed a link to an anchor, like indexbody.html#gel,
then "file:///blah/blah/indexbody.html#gel" gets displayed in the nav
frame.

2) When I do the same thing with the uploaded test copy,
the nav frame reloads and that's all.
The test copy is (at a corporate site)
http://www.scanalytics.com/webtest/index2.html, but I will probably
change these pages frequently. (You can follow the info link to a long
page with anchors.)

Please tell me
I> What am I doing wrong that displays the old main location in the nav
frame,
II> What am I doing wrong that the main frame doesn't go to the top in
the uploaded version (or all else is moot!),
III> If there's simply a better way!

Many thanks!
--complex
and yes, I know frames suck, but I have a specialized situation (CD
distribution) where it'll be acceptable.

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA