首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

iframe 动态联接 .mht

2013-09-05 
iframe 动态连接 .mht1. 单独在浏览器中查看 Template_V10.mht文件正常显示(该文件由excel另存成的)2. 通

iframe 动态连接 .mht
1. 单独在浏览器中查看 Template_V10.mht文件正常显示(该文件由excel另存成的)
2. 通过js把它加载到iframe中,有的浏览器无内容显示,有的浏览器提示“下载”
目标:通过js动态把.mht文件加载到iframe中

主要代码如下:
<body>
    <button onclick="asd()"></button>
            <div title="mht">
                <iframe  style="POSITION: absolute;z-index: -1; width:100%;height:100%;" id="DivReport3"
                    ></iframe>
            </div>
</body>
</html>
<script type="text/javascript">
    function asd() {
        var ifra = document.getElementById("DivReport3");
        ifra.src = "Template_V10.mht";
    }
</script> iframe?js?mht
[解决办法]
只有ie支持mht,其他浏览器都不是完全支持或需要插件。
http://en.wikipedia.org/wiki/MHTML

[解决办法]
在ifram里面添加一个 src=""
[解决办法]
<body>
    <button onclick="asd()"></button>
            <div title="mht" id="mhtFrame">
                <iframe  style="POSITION: absolute;z-index: -1; width:100%;height:100%;" id="DivReport3"
                    ></iframe>
            </div>
</body>
</html>
<script type="text/javascript">
    function asd() {
        var div = document.getElementById("mhtFrame");


        div.innerHTML = '<iframe style="POSITION: absolute;z-index: -1; width:100%;height:100%;" id="DivReport3" src="Template_V10.mht" ></iframe>';
    }
</script>

热点排行