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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close a Frame

Status
Not open for further replies.

Micher

Technical User
May 18, 2001
9
CH
I read the thread 216-58608, but I din't understand the answer. #-)
I was trying like this:

in the head into Javascript brackets:
Code:
function frameclose(){
parent.location=parent.frames.main.location 
}

and referencing in the body
Code:
<a href=&quot;javascript:frameclose()&quot;>
but that did't work. Can you tell me where I'm wrong?
Tanks a lot!
 
thread216-58608
top.location=self.location
u c, top & parent arent the same.. parent is just a parent (one level higher, & if there is a nested framesets - u're still in the frame) & top is a highest parent (main frameset)

but i bet u knew that..

here is a complete script that is frequently used 2 kill frameset:
<script>
if (top.location!=self.location){
top.location=self.location
}


//or

if (top.frames.length!=0){
top.location=self.location
}
</script>

just put this script into document that is not supposed to be in the frameset..

Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top