关闭一个窗口 [英] Closing a window
本文介绍了关闭一个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此行来自我的JSP文件。
This line is from my JSP file.
我通过在< a> $中设置目标属性来打开此页面c $ c>标签如
target =_ TOP
,但下面的代码不起作用。如何关闭此窗口?
I opened this page by setting a target attribute in the <a>
tag like target ="_TOP"
, but the code below is not working. How can I close this window?
<div><a href="JavaScript:window.close()">click</a></div>
推荐答案
您只能使用已关闭的JavaScript关闭窗口用JavaScript打开。由于您使用的是HTML方法,因此无法使用。
You can only close a window with JavaScript that has been opened with JavaScript. Since you went with an HTML method, this won't work.
但是,如果您要重新编码以便JavaScript打开窗口而不是......
However, if you were to re-code so that JavaScript was opening the window instead...
<a href="myurl" onclick="window.open('myurl'); return false;">mylink</a>
然后你可以用JavaScript关闭生成的窗口。
Then you could close the resulting window with JavaScript.
这篇关于关闭一个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文