Skip to content Skip to sidebar Skip to footer

How To Set The Height Of A Frame?

How to set the height of a frame used within a frameset in HTML?

Solution 1:

If you're using <frameset> and <frame> tags, you'll need to programmatically set the <frameset>'s rows property to reflect the new height. This will include:

Getting a reference to the <frameset> DOM element from wherever the script is being called. The following example retrieves the first <frameset> element in the outer-most document:

var frset = top.document.getElementsByTagName("frameset")[0];

Setting the rows property. You specify it in the same format as you would writing writing the original HTML (comma delimited, with one entry per element, and * representing 'remaining space'). In the following example, newHeight is assumed to contain the new height for the top frame in a two-frame frameset.

frset.rows = newHeight.toString() + ", *";

Solution 2:

Use the

height

property which specifies the height of the inline frame.

Post a Comment for "How To Set The Height Of A Frame?"