Click to See Complete Forum and Search --> : finding anchor in frame doc in popup window
joelus
03-17-2003, 06:41 AM
Hi,
I have a site where the help link opens a popup window using the usual window.open
The document/web page is made up of a frame, where the top frame contains the actual help.jsp web page and the bottom frame contains a close window and goto top links.
When the popup window pops up, I want the help page in the top frame to go to a specific anchor on that page.
Seems simple, but I can't get it to work.
Any ideas?
Thanks Joel
gil davis
03-17-2003, 06:49 AM
This works:<script>
window.open("http://developer.netscape.com/docs/manuals/js/client/jsref/toplev.htm#1063743");
</script>What are you doing?
joelus
03-17-2003, 07:05 AM
Thanks for the reply, I wasn't quite clear - the document that gets loaded into the popup window (in your example toplev.htm) is a frameset containing two documents in two frames. The anchor I want to reach is in the page loaded into the top frame of toplev.htm
if you know what I mean?
I'm new to javascript so apologies if this has an obvious answer
gil davis
03-17-2003, 07:14 AM
Originally posted by joelus
The anchor I want to reach is in the page loaded into the top frame of toplev.htm
if you know what I mean?How does it get there?
joelus
03-17-2003, 08:05 AM
:confused:
Document framset.html
(this is the page in the popup window)
<html-tags>
<frameset rows="*,10%">
<frame name="help_main" src="help.html">
<frame name="help_footer" src="footer.html" >
<frameset>
</html-tags>
Document help.html
(this goes into top frame of frameset.html)
<html-tags>
<a name="help1">help 1</a>
<a name="help2">help 2</a>
<a name="help3">help 3</a>
</html-tags>
Document main_doc
(this is the webpage which opens the popup)
<html-tags>
For help on this specific thing (help2)
<a href="javascript:PopUpHelp('help2')"
click here</a></html-tags>
help2 is the anchor I want the page in the top frame to go to...
and PopUpHelp looks something like:
function PopUpHelp(name){
WinPop=window.open("frameset.html", "help",
"width=400, height=450")
}
the name that gets passed to the PopUpHelp javascript method is the name of the anchor I want to go to in help.html I just don't know what to do with it...
Hope this clearer...
gil davis
03-17-2003, 08:27 AM
Frameset:<script>
function navigate() {
window.top.help_main.location.hash = window.location.hash.substring(1);
}
</script>
<frameset rows="*,10%" onload="navigate()">
<frame name="help_main" src="help.html">
<frame name="help_footer" src="footer.html">
</frameset>
Opener:function PopUpHelp(nm){
WinPop=window.open("frameset.html#" + nm, "help", "width=400,height=450");
}BTW, don't use reserved words (like name) for variables.
joelus
03-17-2003, 08:44 AM
Thanks gil, that works great!!
:D