首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

jQuery调用js函数解决方法

2013-01-04 
jQuery调用js函数function luger_resize() {。。。。。}$(window).resize(luger_resize())这样的话不能调用 为

jQuery调用js函数

function luger_resize() {
      。。。。。
    }
$(window).resize(luger_resize());


这样的话不能调用 为什么?
[解决办法]
这样就可以了……
<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>

热点排行