homepage Welcome to WebmasterWorld Guest from 54.237.184.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
JavaScript back button for frames
Can anyone help me with a javascript to create a back button
kapow




msg:1490588
 12:42 pm on Apr 3, 2001 (gmt 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>

 

katarina




msg:1490589
 1:56 pm on Apr 3, 2001 (gmt 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

kapow




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved