【发布时间】:2011-06-28 16:01:54
【问题描述】:
我有这个 iframe:
<iframe id="myiframe" src="..." style="width: 90px; height: 70px">
</iframe>
如何更改宽度?我试过了:
$("#myiframe").attr("width", 104);
但 iframe 显示的宽度为 90 像素。
如何更改 90px ?谢谢!!!
【问题讨论】:
-
您混淆了属性的属性。属性只是设置初始值。你想要
HTMLIFrameElement.style.width。或者,您可以去掉内联样式属性并使用HTMLIFrameElement.width和HTMLIFrameElement.height。
标签: javascript jquery html css iframe