closing frame window
Moderator: General Moderators
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
closing frame window
Hello,
I have a frame set with two frames
topFrame
mainFrame
i have a link that <a href="javascript:parent.topFrame.close()">close frame</a>
yet onClick it closes the whole window
how do we close the top frame
Kendall
I have a frame set with two frames
topFrame
mainFrame
i have a link that <a href="javascript:parent.topFrame.close()">close frame</a>
yet onClick it closes the whole window
how do we close the top frame
Kendall
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
You could try this......
......it's the way I normally target windows in a <frameset>
Code: Select all
<a href="javascript:parent.frames.topFrame.close()">close frame</a>-
microthick
- Forum Regular
- Posts: 543
- Joined: Wed Sep 24, 2003 2:15 pm
- Location: Vancouver, BC
That's basically the same as parent.frames.topFrame where 'topFrame' is the name of the frame you are after, doing it the document.frames[] way means you need to remember which order your frames are in... which is not good if you have a big frameset.microthick wrote:I believe that a document.frame[] array is also created, so you might also try closing frames by:
document.frame[0].close()
document.frame[1].close()
etc
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Gen,
if the link to close the frame was the top frame itself...would it work?
i dont know man im not getting to work
heres the link http://onlinetnt.com/redirect.php?ID=32
if the link to close the frame was the top frame itself...would it work?
i dont know man im not getting to work
heres the link http://onlinetnt.com/redirect.php?ID=32
You cant. Don't hold it against me tho.
As far as I recall, a .frame is a .window, but you cannot close that one (neither in javascript 1.0, 1.1 nor 1.2).
Edit:
Digged this up.
http://devedge.netscape.com/library/man ... ml#1200703
As far as I recall, a .frame is a .window, but you cannot close that one (neither in javascript 1.0, 1.1 nor 1.2).
Edit:
Digged this up.
http://devedge.netscape.com/library/man ... ml#1200703
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
JAM,
Hmmmm. this is odd as i wsa reading a tutorial and it said that you could have by referencing the frmes name bu they jus didnt give me an example of the syntax...i guess i have to use and windw.location.href and rest the window to the lower frame url
would this be valid
Hmmmm. this is odd as i wsa reading a tutorial and it said that you could have by referencing the frmes name bu they jus didnt give me an example of the syntax...i guess i have to use and windw.location.href and rest the window to the lower frame url
would this be valid
Code: Select all
<a href="javascript:window.location.href = parent.frames.framename.location.href">close frame</a>I'm not sure if this will work 'cause it's just a thought I had while reading through the topic again.
You could try giving the frame you want to close a style like this......
......and then for the link href that closes the frame try this......
Like I said not sure if it's gonna work but it's worth a try.
You could try giving the frame you want to close a style like this......
Code: Select all
<frameset>
<frame src="where_ever" name="frameTop" style="display:block">
</frameset>Code: Select all
<a href="javascript:window.top.frames.frameTop.style.display='none';">close window</a>-
microthick
- Forum Regular
- Posts: 543
- Joined: Wed Sep 24, 2003 2:15 pm
- Location: Vancouver, BC
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
kendall wrote:ok guys i give up...how do they do that?? isnt it javascript they use
You could get the same effect using an <iframe> in your main page instead of having the site as a <frameset>
You could then do the style="display:none" thing (like I posted above somewhere) but do it with the <iframe>