suba
suba

Reputation: 1

How to set the height of a frame?

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

Upvotes: 0

Views: 5771

Answers (2)

Jason Musgrove
Jason Musgrove

Reputation: 3583

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() + ", *";

Upvotes: 2

rahul
rahul

Reputation: 187090

Use the

height

property which specifies the height of the inline frame.

Upvotes: 0

Related Questions