Posted on 11/03/2009 2:41:25 PM PST by Tunehead54
Help!
I'm using frames and trying to get a website up asap. Please don't suggest css/dreamweaver etc. Thanks.
Problem:
Within a frame I just want (ideally) a FORMS button to reload the whole frames site - eg load index.html - starting at home page in the same window/tab. The first example works as a "Back button" - the second almost works as a home button but it loads the homepage in the current frame. Note: A "leading" space is used to allow the html to display ...
The following works:
---------------------- Forms & Java - "Back Button"
-------- Successfully loads last page in relevant frame
--- Perfect!
< FORM>
NAME="back"
VALUE="BACK"
onClick="history.go(-1)">
< /FORM>
------------------- Almost works as a "Home" button"
------- It loads the home page within the current frame
------- Need it to load the whole home page in the same tab/window
< form action="../index.html" method="get">
< input type="submit" name="B1" " id="B1" value="Home">
< /form>
Note: adding "_top" as the target doesn't work: < form action="../index.html target=_top" method="get">
I am not wedded to this approach I just want some simple in-frame navigation buttons ideally: forward, back, specified page & home buttons.
Just a button that would load a URL "www.mysite.com" in the same tab/window would do nicely but a straight
< A Href="www.mysite.com" Home< /A>
loads the home page in the current frame. Sigh.
Any help would be greatly appreciated (simpler is better). FReepers are the best! Any ping lists for html freaks? ;-)
Is your computer turned on?
Yes. All 6 of them. Why? ;-)
.
the problem is inherent with frames. you need to remember to use number of frames + 1 in any back button actions and a self-referring action. It’s hard to explain in writing but it’s really self-explanatory when you lay it out step by step.
Is ShadowAce a web programmer? Is there a place where various ping lists are listed? Anyone? Buehler? ;-)
So these buttons are suppose to smell? JOKE!
Without seeing the code or site I'm not sure where you are going wrong. Dealing with frames can be difficult at best. What is the Java applet doing? Give some more details or show your code.
Just my opinion.
Do not use frames. I can think of no good reason to use them for website design and I can’t think of many popular and succesful websites that use them anymore.
I’m making an audio-oriented site using yahoo media player which catalogues any mp3s on the page and then plays them consecutively or as you select them - if you change pages then you start over - by using frames the catalogue loads and can be played/paused even while other pages are browsed - at least that’s what I’m working on and why frames made sense at the time. ;-)
I woudln't mess with forms for this.
<a href="/index.html" target="_top">Home</a>
For the back button, you could do a button:
Or you could do a link:
<button onClick="history.go(-1)">Back</button>
<a onClick="history.go(-1)">Back</a>
Looking at that, thanks - Except for QuickBasic and a little assembler for machine level calls I’m a script kiddie - just know enough to be dangerous - but setting up a java command in a forms submit/get is esoteric. - The stupid thing is that I could just copy a “Home” button and use it in an “A Href=”” statement and it works - the “back” button technique suggested there may be a parameter to do as asked a little more elegantly.
PS: I'm cheating anyway - I'm a jscript/cgi/.net newbie just trying to make a few things work! At least with straight html I don't have to cover instances where java is not enabled! ;-)
Thanks - I may have to go that way but you know way more than I - Is there a parameter using either the “button onClick=” or the
“a onClick=” to load a straight url (http://www.mysite.com)?
There are a lot of ways to do this. None are particularly elegant. One method is to use the "onLoad" event on the body tag. It has been a while. Seems like it goes something like this (my javascript might be a bit rusty here)
That will prevent your frameset document from being "framed". Note, change the 'index.html' in the window.open to whatever the document is that contains your frameset.
<body onLoad="if (self != top) { window.open('/index.html','_top','') }">
You could also do a <button onclick="window.open('/index.html','_top','')">Home</button>
But in Post 17 I outlined a way to make your index.html check itself when it loads and make certain that is isn't being loaded in a frame. I think that is the better approach. You could use the window.open function on your button to avoid the second loading of the window in the "_top" window, but I would definitely add the onLoad event to unframe yourself, should anyone try to load your main frameset in another frame.
Frames are the Devil.
Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.