Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Framed Anchor Navigation 1

Status
Not open for further replies.

Genimuse

Programmer
Joined
May 15, 2003
Messages
1,797
Location
US
Sorry, I know this is straightforward but after battling it for multiple hours, I need to go ahead and ask y'all.

Simple frameset, three frames named topframe, mainframe, and bottomframe. "mainframe" has multiple anchors in it (e.g. <a name="12748"></a>). "bottomframe" has a simple navigation menu that looks like this:
Code:
<form name="jump">
  <select name="sections" onChange="jumpMenu(this)">
    <option value="#formmain">Go to Top</option>
    <option value="#12748">Option A</option>
    <option value="#9980">Option B</option>
  </select>
</form>
And the function it refers to looks like this:
Code:
function jumpMenu(selObj) {
  parent.mainFrame.location=selObj.options[selObj.selectedIndex].value;
}
(I had that as an eval(), but don't think I need it in modern IE, where this form will be exclusively used.)

What I want to happen is for the mainframe to just shift to the requested anchor. What actually happens is bottomframe's page is loaded into mainframe.

Again, sorry the question is so basic, but any help would really be appreciated.
 
Remember JS is case-sensitive. You say your frame is called "mainframe", but you refer to it with a capital "F" - "mainFrame". You need to ensure all your frame references have matching case.

Assuming you fix that, give this a whirl. I've not tested it, but it looks like it should work:

Code:
parent.mainFrame.location[b].hash[/b] = selObj.options[selObj.selectedIndex].value;

It might be IE-only, so worth testing in a few browsers.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
My case was correct in the code, so that wasn't the problem, but the .hash made all the difference, thanks! Fortunately this project is just for IE (Pocket IE on the Pocket PC, actually), so I don't even need to test it elsewhere.

Thanks so much, Dan!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top