window.close()的

编程入门 行业动态 更新时间:2024-10-26 06:34:23
本文介绍了window.close()的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 请指导我当前关于window.close()的论文。 我的信息是一个窗口可以关闭,只要它已经由 相同文档中的相同脚本或函数打开了。 这是我有,但没有成功: 功能窗口(网址){ var pdf = window.open(url,null, resizable,scrollbars"); setTimeout(" pdf.close()",2000); } 请澄清,或者帮助......非常感谢! Heinrich Wolf

Hi all, Please direct me to a current treatise of window.close(). My info is that a window can be closed provided it has been opened by the same script or functions within the same document. And this is as far as I''ve got, but no success: function window(url) { var pdf = window.open (url,null,"resizable,scrollbars"); setTimeout("pdf.close()", 2000); } Please clarify, or help... and many thanks! Heinrich Wolf

推荐答案

Heinrich Wolf写道: Heinrich Wolf wrote: 请指导我当前关于window.close()的论文。 我的信息是窗口可以关闭如果它已经由 相同文档中的相同脚本或函数打开了 。 Please direct me to a current treatise of window.close(). My info is that a window can be closed provided it has been opened by the same script or functions within the same document.

通常,尝试关闭 窗口的代码是否在同一个脚本或函数中并不重要。如果窗口没有用脚本打开,则不应该用脚本关闭它。 但打开新窗口的最大问题是弹出窗口阻止 可能会阻止它们打开,所以关闭它们的能力是否是一个相对无关紧要的副问题。 /> 互联网。

Generally it would not matter that the code that attempted to close a window was in the same script or function or not. If the window was not opened with a script it should not be possible to close it with a script. But the biggest issue with opening new windows is that pop-up blocking may prevent them opening at all, so the ability to close them or not is a relatively insignificant side issue in terms of designing for the Internet.

这就是我所拥有的,但没有成功: And this is as far as I''ve got, but no success:

制作没有成功你解释你的代码 实际上做什么的程度往往不会给你任何有用的帮助。

Making "no success" the extent of your explanation of what your code actually does will tend not to get you any useful help.

函数窗口(url) { var pdf = window.open(url,null," resizable,scrollbars"); setTimeout(" pdf.close()",2000) ; } function window(url) { var pdf = window.open (url,null,"resizable,scrollbars"); setTimeout("pdf.close()", 2000); }

作为 - setTimeout的第一个参数提供的字符串值是 在全局执行上下文,你的 - pdf - 被声明为作为局部变量,因此在全局执行中可能未知 上下文。 Richard。

The string values provided as the first argument to - setTimeout - are evaluated in the global execution context, and your - pdf - is declared as a local variable, and so probably unknown in the global execution context. Richard.

Heinrich Wolf于2007年12月12日在comp.lang.javascript写了 : Heinrich Wolf wrote on 12 mrt 2007 in comp.lang.javascript: 请指导我当前关于window.close()的论文。 我的信息是窗口可以关闭,只要它有 由 同样的文件。 这就是我所拥有的,但没有成功: 功能window(url){ var pdf = window.open(url,null," resizable,scrollbars"); setTimeout(" pdf.close()" ;,2000); } Please direct me to a current treatise of window.close(). My info is that a window can be closed provided it has been opened by the same script or functions within the same document. And this is as far as I''ve got, but no success: function window(url) { var pdf = window.open (url,null,"resizable,scrollbars"); setTimeout("pdf.close()", 2000);}

1 不要使用单词窗口, 因为这是为你的后续使用而保留的。 2 pdf未全局定义, 因此超时无法使用执行 3 两秒钟是一个很短的时间 来设置一个远远不能再移除的窗口 试试: < script type =''text / javascript''> var w; 函数doit(url){ w = window.open(url); setTimeout(''w.close()' ',15000); }; < / script> < button onclick =' '度特(QUOT; HTTP://cnn/")''> cnn< / button> - Evertjan。 荷兰。 (请将x''es更改为我的电子邮件地址中的点数)

1 Do not use the word window, as this is reserved for your subsequent use. 2 pdf is not globally defined, so not available to the timeout execution 3 Two seconds is a short time to set up a window far inough to remove it again try: <script type=''text/javascript''> var w; function doit(url) { w = window.open(url); setTimeout( ''w.close()'', 15000); }; </script> <button onclick=''doit("cnn/")''> cnn</button> -- Evertjan. The Netherlands. (Please change the x''es to dots in my emailaddress)

Heinrich Wolf< XX ********** **@hispeed.chwrote in news:cae48 Heinrich Wolf <XX************@hispeed.chwrote in news:cae48

更多推荐

window.close()的

本文发布于:2023-11-09 15:29:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572733.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:window   close

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!