function luger_resize() {
      。。
    }
$(window).resize(luger_resize());这样的话不能调用 为什么?

解决方案 »

  1.   

    这样就可以了……
    <html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript"></script>
        <script type="text/javascript">
            function luger_resize() {
                alert("卧槽,窗体大小变了呀!");
            }
            $(window).resize(
                function(){
                    luger_resize();
                }
            );    
        </script>
    </head>
    <body>
        <div id="divM" style="width:100%;height:900px;" >
        </div>
    </body>
    </html>
      

  2.   

    $(window).resize(RefreshSize);
    $(canvas).mousedown(UIOnMouseDown);
    $(canvas).mousemove(UIOnMouseMove);
    $(canvas).mouseup(UIOnMouseUp);
    $(edit).blur(UpdateLable);
    $(edit).keypress(AutoGrow);
    传递的是个函数名,而不是返回值,切记!
    当然,如果函数非常简单可以原地写,那就用匿名函数也不错。