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

        <bdo id='LLAwt'></bdo><ul id='LLAwt'></ul>
      <tfoot id='LLAwt'></tfoot>

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

        <legend id='LLAwt'><style id='LLAwt'><dir id='LLAwt'><q id='LLAwt'></q></dir></style></legend>

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

        事件是回調鏈中隨處可訪問的全局變量嗎?

        Is event a global variable that is accessible everywhere inside the callback chain?(事件是回調鏈中隨處可訪問的全局變量嗎?)
          • <bdo id='xvZgo'></bdo><ul id='xvZgo'></ul>
          • <legend id='xvZgo'><style id='xvZgo'><dir id='xvZgo'><q id='xvZgo'></q></dir></style></legend>
            <tfoot id='xvZgo'></tfoot>
                <tbody id='xvZgo'></tbody>

              • <small id='xvZgo'></small><noframes id='xvZgo'>

                  <i id='xvZgo'><tr id='xvZgo'><dt id='xvZgo'><q id='xvZgo'><span id='xvZgo'><b id='xvZgo'><form id='xvZgo'><ins id='xvZgo'></ins><ul id='xvZgo'></ul><sub id='xvZgo'></sub></form><legend id='xvZgo'></legend><bdo id='xvZgo'><pre id='xvZgo'><center id='xvZgo'></center></pre></bdo></b><th id='xvZgo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xvZgo'><tfoot id='xvZgo'></tfoot><dl id='xvZgo'><fieldset id='xvZgo'></fieldset></dl></div>
                  本文介紹了事件是回調鏈中隨處可訪問的全局變量嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我只是在玩弄 DOM 和 Javascript 的事件偵聽器,并確實注意到了這一點:

                  I was just playing around with event listeners with DOM and Javascript and did notice this:

                  function chained(msg) {
                      console.log(msg, event);
                  }
                  
                  function onClick() {
                      chained('the body was clicked');
                  }
                  
                  document.body.addEventListener('click', onClick);
                  

                  現在有趣的是......這將輸出:

                  Now the funny thing...this will output:

                  身體被點擊,(MouseEvent)"

                  "the body was clicked, (MouseEvent)"

                  那我問,為什么?它如何傳遞事件對象而不在 chained 調用中發送它?

                  Then I ask, why? how does it passes the event object without sending it on the chained call?

                  function chained(msg) {
                      console.log(msg, namedEventObj); //throw error namedEventObj is not defined
                  }
                  
                  function onClick(namedEventObj) {
                      console.log(event); //outputs (MouseEvent);
                      console.log(nameEventObj); //outputs (MouseEvent);
                      chained('the body was clicked');
                  }
                  
                  document.body.addEventListener('click', onClick);
                  

                  即使我將要在 onClick 函數上傳遞的事件 obj 聲明為 namedEventObj 它也只能用于 onClick 而不能用于 chained 函數...我知道了,這對我來說很有意義...但絕對不是 event 變量可用于 chained 函數.

                  Even If I declare the event obj to be passed on the onClick function as namedEventObj it will available only to onClick but not to chained function...I got this and this makes sense for me...but definitely not the event variable to be available to the chained function.

                  有人知道它為什么會這樣嗎?

                  Anyone know why does it behaves like this?

                  我唯一能想到的是事件實際上是 window.event 并且當某些事件調度和事件時它使自己可用......但這意味著任何元素都可以得到它事件觸發時是否與事件同時調用?

                  The only thing I can think of is that event is in fact window.event and it makes itself available when some event dispatches and Event...but that would mean that any element could get that event information if called at the same time as the event when it triggers?

                  我使用的是 Chrome 11.0.x

                  I am using Chrome 11.0.x

                  推薦答案

                  可以通過window.event訪問當前事件.僅僅使用 event 就是隱式訪問 window.event.

                  One can access the current event through window.event. Just using event is implicitly accessing window.event.

                  這篇關于事件是回調鏈中隨處可訪問的全局變量嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                    <bdo id='9IACa'></bdo><ul id='9IACa'></ul>
                      <tfoot id='9IACa'></tfoot>
                    • <small id='9IACa'></small><noframes id='9IACa'>

                          <tbody id='9IACa'></tbody>

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

                            <legend id='9IACa'><style id='9IACa'><dir id='9IACa'><q id='9IACa'></q></dir></style></legend>
                          1. 主站蜘蛛池模板: 国产在线精品一区二区 | 五月花丁香婷婷 | 国产一区在线免费观看视频 | 91免费在线看 | 在线观看亚洲专区 | 国内精品久久精品 | 蜜桃视频在线观看免费视频网站www | 91黄色片免费看 | 日韩精品久久久久 | 在线观看中文字幕av | 国产免费xxx | 人人爽人人爽 | 欧美 日韩 国产 在线 | 日韩欧美国产精品一区二区 | av三级| 中文精品视频 | 成人av一区二区在线观看 | 日本激情视频中文字幕 | 91免费小视频 | 操一草 | 中文字幕日韩一区二区 | 亚洲三区在线播放 | 国产九九精品 | 欧美日韩亚洲视频 | 久久精品国产久精国产 | 在线午夜电影 | 国产精品69av | 国产日韩欧美一区二区 | 日韩精品无码一区二区三区 | 视频三区 | 日韩乱码在线 | 欧美久久一级特黄毛片 | 激情网站在线 | 高清av在线 | 国产精品永久久久久 | 中文字幕av亚洲精品一部二部 | 日本欧美黄色片 | 久久精品91久久久久久再现 | 久久国内精品 | 啪啪毛片 | 久热精品免费 |