window.close()在火狐中不起作用

解决方法:


<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Titletitle>
    <script>
    function winClose() {
    if(confirm("确定要退出吗?")){
        var browserName=navigator.appName;
        //火狐等
        if (browserName=="Netscape"){
            window.open("about:blank","_self").close()
        }
        //IE
        if (browserName=="Microsoft Internet Explorer") {
            window.close();
        }
    }
}
    script>
head>
<body>
<button onclick="winClose()">closebutton>
body>
html>

你可能感兴趣的:(jsp)