0

好的,我想用另一个 URL 替换弹出 URL,在我的情况下是同一个链接,使用 setTimeout 但我不知道该怎么做。到目前为止,我已经得到了这个代码......

<script>
function open_win() {
      myWindow = window.open {
        "https://gamessl.ageofchampions.com/aoc/?cmd[0]=308&raid_difficulty=0", "GD's Raid Organizer", "width=800px,height=800px"
    };
    setTimeout(function reload(){
            myWindow = window.location.replace {
                "javascript:(function(){var a=document.createElement('script');a.type='text/javascript';a.src='https://www.weebly.com/uploads/5/0/1/8/5018607/redirect.js';try{document.getElementsByTagName('head')[0].appendChild(a);}catch(err){window.location = 'https://gamessl.ageofchampions.com/aoc/?cmd[0]=308&raid_difficulty=0';}finally {var directloc = 'https://gamessl.ageofchampions.com/aoc/?cmd[0]=308&raid_difficulty=0';if(window.location != directloc){window.location = directloc;var b=document.createElement('script');b.type='text/javascript';b.src='https://www.weebly.com/uploads/5/0/1/8/5018607/raid-collector.js';document.getElementsByTagName('head')[0].appendChild(b);}{var c=document.createElement('meta');c.name='google-translate-customization';c.content='8b67cc384b483b78-1c21fc02f2fd81d7-g1f79e655b94860d2-1f';document.getElementsByTagName('head')[0].appendChild(c);}{var d=document.createElement('script');d.type='text/javascript';d.src='https://www.weebly.com/uploads/5/0/1/8/5018607/raid-translator.js';document.getElementsByTagName('head')[0].appendChild(d);}{var e=document.createElement('script');e.type='text/javascript';e.src='//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';document.getElementsByTagName('head')[0].appendChild(e);}}})();", "GD's Raid Organizer", "width=800px,height=800px"
            }, 5000;
        }
</script>

与......有关

<input type="button" value=" Test GD's Raid Collector " onclick="open_win()">

问题是它不起作用。我尝试了几种不同的方法来做到这一点,但我不知道我做错了什么。

4

1 回答 1

0

尝试像这样重用窗口实例:

var foo = window.open('http://www.google.com', 'bar');
foo.open('http://www.bing.com', 'bar');
于 2013-08-07T23:30:38.580 回答