<script type="text/javascript">
window.onload = function ()
{
var msg = document.getElementById("msg");
var ifr = document.createElement("iframe");
ifr.style.position = "absolute";
ifr.style.display = "block";
ifr.style.zIndex = "9999999";
ifr.style.left = msg.offsetLeft;
ifr.style.top = msg.offsetTop;
ifr.width = "190px";
ifr.height = "180px";
ifr.scrolling = "no";
ifr.frameborder = "1px";
msg.appendChild(ifr);
msg.zIndex = "9999999";
}
</script>
<div id="msg" style="width:285px;height:275px;padding:0px;overflow:hidden;margin-left:22px;border: #FF0000 1px solid">
<iframe id="iframenews" src="arm.html" width="290" height="274" frameborder="0" marginheight="0" marginwidth="0" scrolling="No" allowtransparency="true" ></iframe>
</div>
本文介绍了一种通过JavaScript动态加载iframe的方式,在网页上实现图文并茂的展示效果,具体步骤包括创建iframe元素、设置样式以及将iframe插入到指定位置。此方法适用于需要在现有页面中增加动态内容而不改变原有布局的场景。
581

被折叠的 条评论
为什么被折叠?



