这是我的代码在localhost上运行正常,但没有在live donn上工作
<script language="javascript" type="text/javascript">
function closeWindow() {
window.open('','_parent','');
window.close();
}
</script>
<a href="javascript:closeWindow();">Close Tab</a>
也试过这个
<script>
function Exit() {
var x=confirm('Are You sure want to Close Tab');
if(x) window.close();
}
</script>
<button name='closeIt' onClick="Exit()" >CLICK </Button>
请帮助
答案 0 :(得分:0)
简单询问确认是否属实,然后继续下一步行动,如果没有做任何动作则保持同一页面
function Exit(){
var retVal = confirm("Do you want to continue ?");
if( retVal == true ){
document.write ("User wants to continue!");
return true;
}
else{
document.write ("User does not want to continue!");
return false;
}
}
我希望它的工作
答案 1 :(得分:0)
试试这个:
var win = window.open("about:blank", "_self");
win.close();