问题
How to set the height of a frame used within a frameset in HTML?
回答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() + ", *";
回答2:
Use the
height
property which specifies the height of the inline frame.
来源:https://stackoverflow.com/questions/1648355/how-to-set-the-height-of-a-frame