久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='UnWCR'></small><noframes id='UnWCR'>

  1. <tfoot id='UnWCR'></tfoot>
    <i id='UnWCR'><tr id='UnWCR'><dt id='UnWCR'><q id='UnWCR'><span id='UnWCR'><b id='UnWCR'><form id='UnWCR'><ins id='UnWCR'></ins><ul id='UnWCR'></ul><sub id='UnWCR'></sub></form><legend id='UnWCR'></legend><bdo id='UnWCR'><pre id='UnWCR'><center id='UnWCR'></center></pre></bdo></b><th id='UnWCR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UnWCR'><tfoot id='UnWCR'></tfoot><dl id='UnWCR'><fieldset id='UnWCR'></fieldset></dl></div>
  2. <legend id='UnWCR'><style id='UnWCR'><dir id='UnWCR'><q id='UnWCR'></q></dir></style></legend>

        <bdo id='UnWCR'></bdo><ul id='UnWCR'></ul>

      將事件偵聽器添加到在新窗口中打開的文檔中

      Add event listener to document opened in new window(將事件偵聽器添加到在新窗口中打開的文檔中)

          <tfoot id='SpRQ7'></tfoot>
            <tbody id='SpRQ7'></tbody>
          <legend id='SpRQ7'><style id='SpRQ7'><dir id='SpRQ7'><q id='SpRQ7'></q></dir></style></legend>
        • <small id='SpRQ7'></small><noframes id='SpRQ7'>

          • <bdo id='SpRQ7'></bdo><ul id='SpRQ7'></ul>
          • <i id='SpRQ7'><tr id='SpRQ7'><dt id='SpRQ7'><q id='SpRQ7'><span id='SpRQ7'><b id='SpRQ7'><form id='SpRQ7'><ins id='SpRQ7'></ins><ul id='SpRQ7'></ul><sub id='SpRQ7'></sub></form><legend id='SpRQ7'></legend><bdo id='SpRQ7'><pre id='SpRQ7'><center id='SpRQ7'></center></pre></bdo></b><th id='SpRQ7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SpRQ7'><tfoot id='SpRQ7'></tfoot><dl id='SpRQ7'><fieldset id='SpRQ7'></fieldset></dl></div>

              • 本文介紹了將事件偵聽器添加到在新窗口中打開的文檔中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                是否有任何事情阻止我將事件偵聽器添加到由 window.open() 調用產生的窗口中?

                Is there anything that prevents me from adding a event listener to the window that results from a window.open() call?

                我正在嘗試設置一個處理函數,以便在新文檔的可見性更改事件上觸發,但該處理函數沒有被調用.

                I am trying to set a handler function to be triggered on a visibility change event on the new document, but this handler function is not being called.

                推薦答案

                沒有什么可以阻止你這樣做(只要你打開的窗口與父/打開器窗口在同一個域中;只是想象一下,如果不是這種情況,惡意的人會做什么).一旦你有了那個新窗口的 window 對象,你就可以對它做任何你想做的事情.window.open() 返回新窗口的window 對象:

                There's nothing that prevents you from doing that (as long as the window you are opening is in the same domain as the parent/opener window; Just imagine what malicious people could do if that weren't the case). Once you have the window object of that new window, then you can do whatever you want to it. window.open() returns the window object of the new window:

                // * All of this code is happening inside of the parent window,
                // * but you can also 'inject' scripts into the new window if you wish.
                
                // window.open() returns the new window's window object
                var newWin = window.open('http://stackoverflow.com');
                // Run all of your code onload, so you can manipulate the 
                // new window's DOM. Else, you're just manipulating an empty doc.
                newWin.onload = function () {
                    // `this`, in this context, makes reference to the new window object
                    // You can use DOM methods, on the new document, with it.
                    var myElem = this.document.getElementById('custom-header');
                    console.log("Window object: ", this);
                    console.log("Window's location: ", this.location.href);
                    console.log("Id of element in new window: ", myElem.id);
                    // Attach a click event to the new document's body
                    this.document.body.onclick = function () {
                        // `this`, inside of a listener, is the element itself
                        // but this console.log will log inside of the parent window
                        console.log(this);
                        this.style.transition = 'all 1s';
                        this.style.opacity = 0;
                    };
                    this.document.body.addEventListener('click', function () {
                        // Now, let's log inside of the new window.
                        // Since in here, this === this.document.body,
                        // then you'll have to use the newWin var we set before.
                        // newWin is the window object.
                        newWin.console.log('Logging in new window!');
                    });
                };
                

                這篇關于將事件偵聽器添加到在新窗口中打開的文檔中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

                  <tbody id='TL5aA'></tbody>
                <legend id='TL5aA'><style id='TL5aA'><dir id='TL5aA'><q id='TL5aA'></q></dir></style></legend>
                <tfoot id='TL5aA'></tfoot>
              • <small id='TL5aA'></small><noframes id='TL5aA'>

                    • <bdo id='TL5aA'></bdo><ul id='TL5aA'></ul>
                        1. <i id='TL5aA'><tr id='TL5aA'><dt id='TL5aA'><q id='TL5aA'><span id='TL5aA'><b id='TL5aA'><form id='TL5aA'><ins id='TL5aA'></ins><ul id='TL5aA'></ul><sub id='TL5aA'></sub></form><legend id='TL5aA'></legend><bdo id='TL5aA'><pre id='TL5aA'><center id='TL5aA'></center></pre></bdo></b><th id='TL5aA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='TL5aA'><tfoot id='TL5aA'></tfoot><dl id='TL5aA'><fieldset id='TL5aA'></fieldset></dl></div>

                        2. 主站蜘蛛池模板: 国产免费自拍 | 精品久久久久久亚洲精品 | 国产精品永久 | 欧美一级免费黄色片 | 在线中文视频 | 男人的天堂久久 | 国产精品免费一区二区三区四区 | 色婷婷综合久久久中字幕精品久久 | 中文字幕一区二区三区乱码在线 | 欧美黑人一区 | 欧美黄色一区 | 99视频免费看 | 免费看黄色视屏 | 手机av网 | 一区二区三区四区电影视频在线观看 | 在线一区二区三区 | 国产成人在线免费 | 欧美日韩视频 | 久久com| 亚洲精品成人 | 淫片专区 | 欧美综合一区二区 | 欧美午夜精品久久久久久浪潮 | 91国内精品久久 | 免费视频一区二区 | 91精品国产欧美一区二区 | 中文亚洲视频 | 欧美精品1区 | 亚洲自拍偷拍欧美 | 日韩一区中文字幕 | 99视频在线免费观看 | 激情综合五月 | 久久久国产精品 | 欧美男人天堂 | 日韩av一区二区在线观看 | 波多野结衣二区 | 国产美女特级嫩嫩嫩bbb片 | 亚洲欧美在线视频 | 欧美xxxx黑人又粗又长 | 午夜天堂精品久久久久 | 国产伦精品一区二区三区四区视频 |