久久久久久久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. 主站蜘蛛池模板: 久久久久久免费毛片精品 | 天天影视色综合 | 久久久久久色 | 9久久| 精品久久影院 | 桃色五月 | 亚洲 欧美 综合 | 欧美成视频 | 国产91在线观看 | 成人在线免费视频观看 | 中文精品一区二区 | gogo肉体亚洲高清在线视 | 国际精品鲁一鲁一区二区小说 | a毛片| 久久精品亚洲欧美日韩精品中文字幕 | 日韩精品中文字幕在线 | 三级免费av | 黄在线| 午夜欧美 | 久久久久久久久久久久久久av | 久久999| 国产精品久久久久久福利一牛影视 | 一二三在线视频 | 黄网免费看 | chinese中国真实乱对白 | 国产欧美一区二区三区另类精品 | 在线中文字幕亚洲 | 成人av网站在线观看 | 一级毛片视频 | 亚洲欧美日韩国产 | 亚洲国产精品久久久久婷婷老年 | 日韩一区精品 | 国产精品无码久久久久 | 久久69精品久久久久久国产越南 | 美女福利视频一区 | 亚洲欧美一区二区三区国产精品 | 欧美亚洲视频在线观看 | 91精品中文字幕一区二区三区 | 久久久精品网站 | av在线一区二区三区 | 青青草华人在线视频 |