mamo

<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf8">
    <title>JS</title>
  </head>
  <body>
      <button id="btn">google</button>
      <script>
          var btn = document.getElementById("btn");
          var a = document.createElement("a");

          a.href = "https://www.google.co.jp";

          btn.addEventListener("click", function() {
              // マウスで起こすイベントの情報を設定するものを evt に代入
              var now =new Date();
              var year = now.getFullYear();
              var mon = now.getMonth()+1;
              var date = now.getDate();

              var jst = "http://api-org.nhk.or.jp/v1/pg/list/130/g1/" + year + "-" + mon + "-" + date + ".json";
              var evt = document.createEvent("MouseEvents");
              var b = ["http://yahoo.co.jp","http://google.com","http://www.nhk.or.jp", jst];
              console.log(jst);
              console.log(b[3]);
//              window.open(b[0],"");
                  for(var i=0;i<b.length;i++){
                      window.open(b[i],"");

                  }
            //   // 起こすイベントの情報を設定
            //   //evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0,
            // //                              true, false, false, false, 0, null);
            //
            //   evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0,
            //                               false, false, false, true, 0, null);
            //   a.dispatchEvent(evt); // evt を a に適用させる
          });
      </script>
  </body>

</html>



Related Posts