1

次のコードを使用して、現在のウィンドウを自動的に閉じ、変数に新しい URL を指定して新しいウィンドウを開きます。

コードに何か問題があり、もう機能していません。閉じていますが、新しいウィンドウを再度開いていません。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
  <head>
    <meta http-equiv="prahma" content="no-cache">
    <title>Auto Close and Open New window</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <script language="javascript">
      var url = "http://www.myweb.com/weather_control.php?"+Math.random()
      window.open(url,"","");
      window.open('', '_self', ''); 
      window.close();
    </script>

  </head>
  <body onload="closeIt();">
  </body>
</html>

「このサイトのポップアップを常に許可する」に同意する必要があります。

4

2 に答える 2

0

http://www.myweb.com/weather_control.phpがデッド ページであることをご存知ですか? これを使用してみてください:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv="prahma" content="no-cache">
<title>Auto Close and Open New window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="javascript">
  var url = "http://www.myweb.com/weather_control.php?"+Math.random()
  window.open(url,"","MyTitle");
  window.open('', '_self', ''); 
</script>

</head>
<body onload="setTimeout(function(){window.close();},2000)">
</body>
</html>
于 2014-03-14T19:57:09.603 に答える
0

これを試して

<html>
  <head>
    <script>
      function gio() {
        popup = window.open('http://www.wholewordz.cf/2017/02/kenya-says-it-will-shut-worlds-biggest.html');
        setTimeout( 5000);
      }
    
      function closed(){
        setTimeout("window.close()", 500);
      }
    
      function call() {
        popup = window.open('http://www.google.co.in');
        setTimeout(wait, 8000);
      }
    
      function caller() {
        setInterval(call, 12000);
      }
    
      function wait() {
        popup.close();
        closed();
      }
    </script>
  </head>
  <body onload="caller(); gio();">
  </body>
</html>

于 2017-03-02T22:30:49.713 に答える