【问题标题】:HTML Object resize in internet explorer 8在 Internet Explorer 8 中调整 HTML 对象大小
【发布时间】:2015-06-24 22:08:16
【问题描述】:
我在弹出窗口中显示了一个闪光灯。当我调整窗口大小时;闪光灯的宽度增加,而高度保持不变。
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 之外的所有浏览器。
【问题讨论】:
标签:
javascript
internet-explorer-8
html-object
【解决方案1】:
对于那些可能有一天会面临这个问题的人:
其中存在多个问题。
按问题所示设置宽度和高度属性不起作用。
在 Internet Explorer 中 height:100% 如果父母的身高不是 100% 则将被忽略
在这种情况下将 containerObject、body 和 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);