前几天群里有一同学问....这个问题有文化哇...
如果说只是检测页面存在否,直接设置target用伪协议就可以解决了...
不过是iframe[name]的话,就涉及onload的问题了...所以就麻烦了许多....
以下只是加了延迟...并没有"真正"的处理onload的问题....其实可以循环window.open来解决,不过懒的弄就略了...^^

 

<a href="javascript:void(0);" onclick="openC('http://www.google.cn/', 'cs', this)">google</a>
<script type="text/javascript">
window.openC = function (href, target, e) {
    try {
        window.open('javascript:if(!document.body){opener.openC.isNull=true;opener.open("c.asp");close();}', target || '');
        window.setTimeout(function () {
            if (window.openC.isNull) {
                delete window.openC.isNull;
                window.setTimeout(function () {
                    e.fireEvent('onclick');
                }, 500);
            } else {
                window.open(href, target);
            }
        }, 100);
    } catch (exp) {
        alert(exp.message);
    }
};
</script>

相关文章:

  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2021-06-06
猜你喜欢
  • 2021-07-10
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
相关资源
相似解决方案