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

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

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

      1. <legend id='yMlNf'><style id='yMlNf'><dir id='yMlNf'><q id='yMlNf'></q></dir></style></legend>

        <tfoot id='yMlNf'></tfoot>

        Javascript,从开启器调用子窗口函数不起作用

        Javascript,calling child window function from opener doesn#39;t work(Javascript,从开启器调用子窗口函数不起作用)

          <tbody id='GbxLy'></tbody>
            <tfoot id='GbxLy'></tfoot>

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

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

              • <bdo id='GbxLy'></bdo><ul id='GbxLy'></ul>

                  本文介绍了Javascript,从开启器调用子窗口函数不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个使用 windows.open(..) 打开弹出窗口的 Web 应用程序.我需要使用window.open"返回的句柄在打开的窗口上调用一个函数,但我总是收到错误消息addWindow.getMaskElements is not a function",好像它无法访问声明的函数在子窗口上.这是 IE 和 FF 中的行为.我的代码如下所示:

                  I'm developing a web application that opens a popup using windows.open(..). I need to call a function on the opened window using the handle returned by "window.open", but I'm always getting the error message "addWindow.getMaskElements is not a function", as if it couldn't access the function declared on child window. This is the behavior in both IE and FF. My code looks like this:

                  function AddEmail(target,category)
                  {
                      if(addWindow == null)
                      {
                          currentCategory = category;
                          var left = getDialogPos(400,220)[0];
                          var top =  getDialogPos(400,220)[1];
                          addWindow = window.open("adicionar_email.htm",null,"height=220px, width=400px, status=no, resizable=no");
                          addWindow.moveTo(left,top);
                          addWindow.getMaskElements ();
                      }
                  }
                  

                  我已经用谷歌搜索并阅读了不同的可靠来源,显然这应该有效,但它没有.另一件事是,子窗口中的函数在 adicionar_email.htm 文件中包含的单独 .js 文件中声明.这有什么不同吗?不应该..所以,如果有人遇到过类似的问题,或者知道我做错了什么,请回复此消息.提前致谢.

                  I've googled and read from different reliable sources and apparently this is supposed to work, however it doesn't. One more thing, the functions in child window are declared in a separate .js file that is included in the adicionar_email.htm file. Does this make a difference? It shouldn't.. So, if anyone has ran into a similar problem, or has any idea of what I'm doing wrong, please, reply to this message. Thanks in advance.

                  肯尼亚

                  推荐答案

                  窗口创建不是阻塞操作;脚本在该窗口打开并加载 HTML & 时继续执行javascript并解析它.

                  The window creation is not a blocking operation; the script continues to execute while that window is opening and loading the HTML & javascript and parsing it.

                  如果您要在原始页面上添加这样的链接:

                  If you were to add a link on your original page like this:

                  <a href="#" onclick="addWindow.getMaskElements();">Test</a>
                  

                  你会看到它有效.(我试了一下只是为了确定.)

                  You'd see it works. (I tried it just to be sure.)

                  **编辑**

                  其他人通过在目标文档中调用 onload 发布了解决方法,这是另一种方法:

                  Someone else posted a workaround by calling an onload in the target document, here's another approach:

                  function AddEmail()
                  {
                  
                          if(addWindow == null) {
                          addWindow = window.open("test2.html",null,"height=220px, width=400px, status=no, resizable=no");
                          }
                  
                          if(!addWindow.myRemoteFunction) {
                              setTimeout(AddEmail,1000);
                          } else { addWindow.myRemoteFunction(); }
                  }
                  

                  这会一直尝试每 1 秒调用一次 addWindow.myRemoteFunction,直到成功调用它.

                  This keeps trying to call addWindow.myRemoteFunction every 1 second til it manages to sucessfully call it.

                  这篇关于Javascript,从开启器调用子窗口函数不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  业务场景:使用update语句去更新数据库字段。 原因:update接收值不正确。原来代码: $query = "UPDATE student SET date = now() WHERE id = $id";$result = $mysqli-query($query2) or die($mysqli-error); // 问题出现了在这句 $data = $result-fetch_ass
                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在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中的序数)
                1. <i id='vS6tn'><tr id='vS6tn'><dt id='vS6tn'><q id='vS6tn'><span id='vS6tn'><b id='vS6tn'><form id='vS6tn'><ins id='vS6tn'></ins><ul id='vS6tn'></ul><sub id='vS6tn'></sub></form><legend id='vS6tn'></legend><bdo id='vS6tn'><pre id='vS6tn'><center id='vS6tn'></center></pre></bdo></b><th id='vS6tn'></th></span></q></dt></tr></i><div id='vS6tn'><tfoot id='vS6tn'></tfoot><dl id='vS6tn'><fieldset id='vS6tn'></fieldset></dl></div>
                    <bdo id='vS6tn'></bdo><ul id='vS6tn'></ul>

                      <tbody id='vS6tn'></tbody>
                      • <small id='vS6tn'></small><noframes id='vS6tn'>

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

                          1. <tfoot id='vS6tn'></tfoot>