Closing a frame?

Discussion in 'Programming' started by SimThePhpCoder, May 19, 2008.

  1. #1
    How Can I make a link that closes that frame?
     
    SimThePhpCoder, May 19, 2008 IP
  2. dylanj

    dylanj Peon

    Messages:
    173
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    As far as my knowledge extends, I don't think you can "close" frames and make them disappear. You could instead link to a page with a different frame set, where the frame you don't want no longer exists. Otherwise, you could use some Javascript. I don't know if Javascript works this way, i've never tried to use it with frames like this:
    
    <a href="#" onClick="javascript: document.myFrame.style.visibility='hidden';">Close</a>
    <frame src="blah.html" id="myFrame">
    
    Code (markup):
    The code above in it's current state will not work. Period. But, if you do some research and modify a few things, it may work...
     
    dylanj, May 20, 2008 IP
  3. SimThePhpCoder

    SimThePhpCoder Well-Known Member

    Messages:
    949
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #3
    I need some code that actual works. I know nothing of javascript.
     
    SimThePhpCoder, May 20, 2008 IP
  4. dylanj

    dylanj Peon

    Messages:
    173
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #4
    You should really read through that code before just ignoring it. There's actually very little Javascript involved, and the Javascript that IS involved, is very very simple.

    However, even if you don't know any Javascript, all you'll need to do is replace "myFrame" in "document.myFrame.style" with the name of your frame, and that should work. You'll also need to put id="whateveryourframeiscalled" in the <frame> tag. They'll have to have exactly the same names, it will be case sensitive.
     
    dylanj, May 21, 2008 IP
  5. SimThePhpCoder

    SimThePhpCoder Well-Known Member

    Messages:
    949
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #5
    i did that and it still didn'twork. ;[
     
    SimThePhpCoder, May 21, 2008 IP
  6. dylanj

    dylanj Peon

    Messages:
    173
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #6
    If that didn't work, then there might not be a way to "Close" a frame... :s
     
    dylanj, May 21, 2008 IP