我有一个弹出窗口,当用户同时打开和关闭弹出窗口时,它给出了脚本错误。下面的代码用于弹出窗口。
         <html>
    <head>
   <script src="../../StaticContent/Scripts/jquery-1.7.2.min.js"
        type="text/javascript"></script>
    <script src="../../StaticContent/Scripts/jquery-ui-1.8.20.custom.js"
        type="text/javascript"></script>
            <script type="text/javascript" language="javascript">
             function CloseWarning() {
                        return "Do you want to close the window";
                    }
function onload()
{
}
        </script></head>
            <body onbeforeunload="return CloseWarning();" onload="onload();">
              //Some html
            <script type="text/javascript" language="javascript">
                $(document).ready(
                    function() {
            //Some code
            });
            </script>
            </body>
            </html>
我试过调试,它在 $(document).ready() 行给出错误。我认为由于在完全加载 HTML 之前关闭弹出窗口会导致此问题。
有什么线索???