单击一次关闭按钮不起作用 [英] Clicking once on close button not working
本文介绍了单击一次关闭按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关于javascript的问题.
我正在使用以下语法关闭输入类型按钮的window(IE)
Hi,
I have an issue with javascript.
I am using the following syntax for closing the window(IE) for an input type button
onclick="javascript:opener=self;window.close();"
当我单击关闭按钮时,警告消息窗口显示如下
When i click on close button a warning message window is displaying as follows
"The webpage you are viewing is trying to close
Do you want to close this tab
Yes / NO
"
然后我在警告消息窗口中单击是"按钮,它再次显示相同的警告窗口.我再次单击警告消息窗口中的是"按钮,现在它关闭了该窗口.
我很困惑,请帮助我.
在此先感谢...
Then i click on yes button in the warning message window it again displays the same warning window. Again i clicked on yes button in warning message window now it closes the window.
I am very much confused please help me..
Thanks in advance...
推荐答案
尝试使用此代码,简单易行
btnclick上的
Try this code and simple
<script language="JavaScript" type="text/javascript">
<!--
function closeW()
{
window.opener = self;
window.close();
}
// -->
</script>
尝试此代码
on btnclick try this code
string str1 = "<script language='javascript'>window.close();</script>";
Response.Write(str1);
或
or
string str1 = "<script language='javascript'>opener.document.location.reload(); window.close();</script>";
Response.Write(str1);
这篇关于单击一次关闭按钮不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文