www.webdeveloper.com
Results 1 to 2 of 2

Thread: Show/hide left frame

  1. #1
    Join Date
    Aug 2006
    Posts
    12

    Show/hide left frame

    Ok, im trying show/hide the left menu frame using a link in the top frame, but when I click the link it closes it self and not the menu frame. How can I get the top frame to close only the menue frame and not its self? if you didn't understand that look at the code you'll know what im talking about.

    Here is the frame code
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    	<title>Untitled</title>
    	
    	<script type="text/javascript">
    
    var columntype=""
    var defaultsetting=""
    
    function getCurrentSetting(){
    if (document.body)
    return (document.body.cols)? document.body.cols : document.body.rows
    }
    
    function setframevalue(coltype, settingvalue){
    if (coltype=="rows")
    document.body.rows=settingvalue
    else if (coltype=="cols")
    document.body.cols=settingvalue
    }
    
    function resizeFrame(contractsetting){
    if (getCurrentSetting()!=defaultsetting)
    setframevalue(columntype, defaultsetting)
    else
    setframevalue(columntype, contractsetting)
    }
    
    function init(){
    if (!document.all && !document.getElementById) return
    if (document.body!=null){
    columntype=(document.body.cols)? "cols" : "rows"
    defaultsetting=(document.body.cols)? document.body.cols : document.body.rows
    }
    else
    setTimeout("init()",100)
    }
    
    setTimeout("init()",100)
    
    </script>
    	<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
       <frameset rows="64,*">
       <frame name="top" scrolling="no" noresize src="home.html">
    <frameset cols="150,*">
       <frame name="contents" src="frmleft1.html">
       <frame name="main" src="frmmain1.html">
    </frameset>
    </frameset>
    
    </head>
    
    <body>
    
    
    </body>
    </html>
    And here is the top link thats suppose to show and hide the left frame (it must be saved as "home.html" in the same directory as the code above

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    	<title>Untitled</title>
    	
    	<a href="javascript:parent.resizeFrame('5,*')">Show/Hide Left Frame</a>
    	
    </head>
    
    <body>
    
    
    </body>
    </html>
    I would really appreciate the help so that I can continue on my project

  2. #2
    Join Date
    Aug 2006
    Posts
    12
    Here if you dont want to mess with all that copy, pasting, and saving, just download the ready to go example code right here.

    http://www.uploading.com/files/167BK...rames.zip.html

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles