|
-
Sep 30th, 2001, 07:22 AM
#1
Thread Starter
Junior Member
Java script to resize frames
Okay, im using the <iframe> tag, and i want to be able to resize this using javaScript from INSIDE the frame. In other words the page in the frame can change the width of the frame whenever needed.
Does anyone have any clue as to how to do this?
Thanks in advance,
Sythe, xxx
-
Oct 1st, 2001, 12:34 AM
#2
Hyperactive Member
Use this:
Place this function in the parent HTML File, say try.htm
Code:
function adjustFrame (frame) {
if (document.all) {
var w = frame.document.body.scrollWidth;
var h = frame.document.body.scrollHeight;
document.all[frame.name].width = w;
document.all[frame.name].height = h;
}
<body>
<iframe name=myframe src=test.htm>
</iframe>
</body>
In the HTML File that is loaded in the IFrame, call this:
Code:
Test.htm
------------
<body onload="adjustFrame (this);">
In the above function, the iFrame is sized to the size of the target document itself...so if u want to hard code the size change the w and h values conveniently.
- Jemima.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|