gpt4 book ai didi

javascript - 在 Internet Explorer 8 中调整 HTML 对象大小

转载 作者:行者123 更新时间:2023-11-28 00:09:30 25 4
gpt4 key购买 nike

我有一个 Flash,正在弹出窗口上显示。当我调整窗口大小时;闪光灯的宽度增加,而高度保持不变。

var objectNode = document.createElement("object");
objectNode.appendChild(param);
objectNode.id = viewerId;
objectNode.width = "100%";
objectNode.height = "100%";
objectNode.classid = "clsid:" + SOME_ID;
containerObject.appendChild(objectNode);

containerObject 是一个 HTMLDivElement。这当然适用于除 Internet Explorer 8 之外的所有浏览器。

最佳答案

对于那些有一天可能会遇到此问题的人:

这其中存在多个问题。

  1. 按照问题所示设置宽度和高度属性不起作用。

  2. 在 Internet Explorer 中,如果 parent 的高度不是 100%,则 height:100% 将被忽略

在本例中将容器对象、主体和 html 的高度更改为 100% 解决了该问题。

var htm = document.getElementsByTagName("html")[0].style.height="100%";
var bod = document.getElementsByTagName("body")[0].style.height="100%";
var objectN = document.createElement("object");
containerObject.setAttribute("style", "height:100%");
objectN.appendChild(param);
objectN.setAttribute("id", "viewer");
objectN.setAttribute("style", "width:100%;height:100%;");
objectN.setAttribute("classid", "clsid:" + PLUGIN_CLSID)
containerObject.appendChild(objectN);

关于javascript - 在 Internet Explorer 8 中调整 HTML 对象大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31025254/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com