`
齐晓威_518
  • 浏览: 607629 次
  • 性别: Icon_minigender_1
  • 来自: 郑州
社区版块
存档分类
最新评论

JS 父窗体中设置iframe中页面的前进、后退、刷新、首页

 
阅读更多

<input id="Button1" type="button" value="前进" onclick="document.getElementById('MainFrm').contentWindow.history.forward();" />
<input id="Button2" type="button" value="后退" onclick="document.getElementById('MainFrm').contentWindow.history.back();" />

在IE中iframe或者frame的contentWindow属性可以省略,但在Firefox中如果要对iframe对象进行编辑则必须指定contentWindow属性

 

 

JS 父窗体中设置iframe中页面的前进、后退、刷新、首页

$(".btnFn").click(function () {
                var fnVal = $.trim($(this).text());
                if (fnVal == "前进") {
                    if (window.frames["frameDesktop"].history) {
                        window.frames["frameDesktop"].history.go(1);
                    }
                } else if (fnVal == "后退") {
                    if (window.frames["frameDesktop"].history) {
                        window.frames["frameDesktop"].history.go(-1);
                    }
                } else if (fnVal == "刷新") {
                    $("#frameDesktop").attr("src", trunUrl);
                } else {//首页
                    trunUrl = "AppList.aspx";
                    $("#frameDesktop").attr("src", "AppList.aspx");
                }
            });

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics