HTML DOM marginHeight 屬性
定義和用法
marginHeight 屬性可設(shè)置或返回框架的頂部和底部頁空白(以像素為單位)。
語法
frameObject.marginHeight=pixels
實(shí)例
在我們的例子中,首先將創(chuàng)建包含帶有兩個(gè)列的框架集的 HTML 文檔。每列設(shè)置為瀏覽器窗口的 50%:
<html>
<frameset cols="50%,50%">
<frame id="leftFrame" marginheight="50"
src="frame_marginheight.htm">
<frame id="rightFrame" marginheight="100"
src="frame_a.htm">
</frameset>
</html>
HTML 文檔 "frame_marginheight.htm" 被放入第一列,而 HTML 文檔 "frame_a.htm" 被放入第二列。
下面是 "frame_marginheight.htm" 的源代碼:
<html>
<body>
script type="text/javascript">
x=parent.document.getElementById("leftFrame");
y=parent.document.getElementById("rightFrame");
document.write("Top/Bottom margins for leftFrame: ");
document.write(x.marginHeight);
document.write("<br />Top/Bottom margins for rightFrame: ");
document.write(y.marginHeight);
</script>
</body>
</html>