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

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

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

        <tfoot id='qLKzb'></tfoot>

        获取用于 jQuery 操作的弹出窗口的 DOM 元素

        Get DOM elements of a popup for jQuery manipulation(获取用于 jQuery 操作的弹出窗口的 DOM 元素)
        <i id='oYkfB'><tr id='oYkfB'><dt id='oYkfB'><q id='oYkfB'><span id='oYkfB'><b id='oYkfB'><form id='oYkfB'><ins id='oYkfB'></ins><ul id='oYkfB'></ul><sub id='oYkfB'></sub></form><legend id='oYkfB'></legend><bdo id='oYkfB'><pre id='oYkfB'><center id='oYkfB'></center></pre></bdo></b><th id='oYkfB'></th></span></q></dt></tr></i><div id='oYkfB'><tfoot id='oYkfB'></tfoot><dl id='oYkfB'><fieldset id='oYkfB'></fieldset></dl></div>
        • <bdo id='oYkfB'></bdo><ul id='oYkfB'></ul>
            <tbody id='oYkfB'></tbody>

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

              <tfoot id='oYkfB'></tfoot>
                <legend id='oYkfB'><style id='oYkfB'><dir id='oYkfB'><q id='oYkfB'></q></dir></style></legend>

                • 本文介绍了获取用于 jQuery 操作的弹出窗口的 DOM 元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在创建一个弹出窗口,如下所示:

                  I am creating a popup as follows:

                     var comet = {
                  
                          popup: null, 
                  
                          newPopup: function(windowsname, w, h){
                              this.popup = window.open(windowsname, windowsname, 'width=' + w + ',height=' + h);
                              var self = comet;
                              var logOut= null;
                              $(this.popup.document).ready(function(){
                                  logOut = self.popup.document.getElementById('logout');
                                  console.log(logOut);
                                  $(logOut).live('click', function(){
                                      alert('HELLO');
                                      return false;
                                  })
                              })
                          },
                  
                          some_function: function(){
                               //calling it here:
                               this.newPopup('index.php',1120,550);
                          }
                      }
                  

                  logOut 有时(通常在第一个窗口打开时)返回 null.此外,点击处理程序永远不会通过,原始点击处理程序会运行.

                  The logOut sometimes (usually on the 1st window open) returns null. Also, the click handler never goes through and the original click handler operates.

                  如何覆盖弹出窗口的真实点击处理程序?
                  这两个页面都在我的网站上,所以应该没有跨站问题..

                  How do I overwrite the real click handler of the popup?
                  Both pages are on my site, so there should be no cross site issues..

                  这是一个小提琴,显示了我正在尝试做的一些事情:http://jsfiddle.net/maniator/K2B3q/

                  Here is a fiddle that shows a little of what I am trying to do: http://jsfiddle.net/maniator/K2B3q/

                  推荐答案

                  在 Firefox 4 和 Chrome 11 中测试和工作.检查一下.

                  Tested and working in Firefox 4 and Chrome 11. Check it out.

                  $(function()
                  {
                      var comet =
                      {
                          popup: null,  
                          newPopup: function(url, w, h)
                          {
                              this.popup = window.open(url, url, 'width=' + w + ',height=' + h);
                              var self = this;
                  
                              this.popup.onload = function ()
                              {
                                var doc = this.document,
                                    script = doc.createElement('script');
                                script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js';
                                script.onload = function ()
                                {
                                    function setup()
                                    {
                                        $('#logout').click(function () { alert('It worked!'); });
                                    }
                  
                                    script = doc.createElement('script');
                                    script.textContent = "(" + setup.toString() + ")();";
                                    doc.body.appendChild(script);
                                };
                  
                                doc.head.appendChild(script);
                              };
                          },
                  
                          foo: function()
                          {
                              this.newPopup('http://jsbin.com/amuza3/2', 600, 400);
                          }
                      };
                  
                      $('#clickme').click(function ()
                      {
                          comet.foo();
                      });
                  });
                  

                  这篇关于获取用于 jQuery 操作的弹出窗口的 DOM 元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)

                      <bdo id='puvgZ'></bdo><ul id='puvgZ'></ul>
                      <legend id='puvgZ'><style id='puvgZ'><dir id='puvgZ'><q id='puvgZ'></q></dir></style></legend>

                        <tfoot id='puvgZ'></tfoot>

                              <tbody id='puvgZ'></tbody>
                            <i id='puvgZ'><tr id='puvgZ'><dt id='puvgZ'><q id='puvgZ'><span id='puvgZ'><b id='puvgZ'><form id='puvgZ'><ins id='puvgZ'></ins><ul id='puvgZ'></ul><sub id='puvgZ'></sub></form><legend id='puvgZ'></legend><bdo id='puvgZ'><pre id='puvgZ'><center id='puvgZ'></center></pre></bdo></b><th id='puvgZ'></th></span></q></dt></tr></i><div id='puvgZ'><tfoot id='puvgZ'></tfoot><dl id='puvgZ'><fieldset id='puvgZ'></fieldset></dl></div>

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