Click to See Complete Forum and Search --> : Changing a frame's width from script


andy_dodson
12-04-2003, 04:54 PM
Hi all-

Anyone know how to change the width of a standard frame from script? Picture a left frame containing a menu and a right frame containing content.

I want the user to be able to "minimize" the left frame containing the menu without grabbing/dragging the border...quick click and it's minimized. Tried all kinds of tricks to alter the frame's width from script, but no joy so far.

Thanks!

FishyMonkey78
12-04-2003, 05:04 PM
Have you tried doing some sort of onClick with locating that frame you want to resize through the DOM with document.frames and all that? Figuring out the width and height of the frame, storing that data in two variables, then calling up that data...?

I'm not too sure, good luck. Someone more advanced than me will easily be more helpful.

andy_dodson
12-04-2003, 08:22 PM
Tried a couple methods, finally got it.

Frameset with 2 frames (columns):

window.parent.document.all.tags("FRAMESET").item(0).cols = "[new size], *"

Will also work, but frameElement is IE 5.5 or higher:
window.frameElement.parentElement.cols = "[new size], *"

Gonna fire the event in the onClick for a pretty "minimize menu" image. Pretty cool, can make some pinned/unpinned menus ala Viz Studio .NET.

Thanks for the assist!

fredmv
12-04-2003, 08:45 PM
Note that your method will only work in IE (hence the use of document.all). This is a huge problem if you're concerned about your site working in multiple browsers.