Welcome to WebmasterWorld Guest from 54.146.230.149

Forum Moderators: open

Message Too Old, No Replies

JavaScript back button for frames

Can anyone help me with a javascript to create a back button

     
12:42 pm on Apr 3, 2001 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 0


Can anyone help me with a javascript to create a back button on a framed website? I want a back button on my navigation frame but I want it to make the 'main page frame' go back. Can this be done??? I have this simple script but it only works within the same frame.

<a href="#" target="stage" onClick="history.go(-1)">Back</a>

1:56 pm on Apr 3, 2001 (gmt 0)

New User

10+ Year Member

joined:July 22, 2002
posts:21
votes: 0


A frameset contains, as you already know, of two or more windows. Each can be dedicated a name when the frameset is opened. This name can be used when you want javascript to perform some kind of action on that page (parent.frames('nameOfWindow').history.back()).

If you haven't named your windows it is still possible to reach them by their position in the frameset.length array. "parent.frames[0].location.href" would change url of one of the framewindows. parent.frames[1] another and so on.

The frameset itself is the "parent" and very often also the "top" unless it is part of another frameset.

I believe, although I'm not 100% sure, that you can dedicate a name of the frameset itself, and reach it by using the name as in "myFrameName.history.back()".

Otherwise - try using "parent" or "top" before your action.

[developer.netscape.com...] explains very well how windows and frames should be referenced to as objects. Check the Client-Side JavaScript Reference documentation.

Good luck,
Katarina

3:45 pm on Apr 6, 2001 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 0


Katarina - Thankyou for your expert help. It works perfectly.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members