How to set the height of a frame?

白昼怎懂夜的黑 提交于 2019-12-11 21:13:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!