You are here: irt.org | FAQ | JavaScript | Frame | Q787 [ previous next ]
Sean McLeary writes:
Resizing a frameset is possible in Internet Explorer 4+ with the following method:
document.all.<framset name>.rows = "<new row definition>"
The same technique works for columns.
For example, the following form button will resize the columns of the parent frameset:
<form> <input type="button" value="resize" onClick="parent.document.body.cols='70%,30%'"> </form>
Steve Schneider writes:
Extending the solution provided by Sean McLeary: By using ID tags
in frames and framesets allows you to resize or change the contents of
nested frames. The code snippet will read the size of both framesets,
and the source of one of the nested frames. It will then resize the
inner frameset. You could also reset the frame source of the named
frame with:
parent.document.all("TopFrame").all("side").src = "NewPage.html"
<html> <head> <title>Test</title> </head> <frameset id="TopFrame" rows=80,*> <frame src="blank.html" name="top" > <frameset id="MiddleFrame" cols=160,*> <frame src="blank.html" name="side" > <frame src="blank.html" name="main" > </frameset> </frameset> </html> - - - - - - - - - - - - - - - - - - - - - - - - - - - <html> <head> <script language="JavaScript"><!-- function go(){ alert("Top Layer Frameset rows: " + parent.document.all("TopFrame").rows); alert("Next Layer Frameset rows: " + parent.document.all("TopFrame").all("MiddleFrame").cols); alert("Next Layer Frame Source: " + parent.document.all("TopFrame").all("side").src); parent.document.all("TopFrame").all("MiddleFrame").cols="220,*"; } //--></script> <title>Blank</title> </head> <body> This is a blank page <input type = "button" value="test" onClick="go();"> </body> </html>