解决方案 »

  1.   

    第三种可以的啊  你没定义show方法吧
      

  2.   

    第六个 是因为方法的返回值做参数了 。6.
    function show(){
    return “show2”
    }function show2(){
    alert("123");
    }
    $(function(){
    setInterval(show(),3000);
    })
      

  3.   

    setInterval("show()",3000);
    这个调用是在全局内调用,也就是这个方法必须是window下的一个方法。 0输出的地方可证明。
    而在jquery的ready函数里边,上下文是document,所以不能调用。2,3输出的地方可证明。<!doctype html>
    <html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.js"></script>
    </head>
    <body>
    <script type="text/javascript">
        function show(){
            console.log(222);
    //        alert("123");
        }
        console.log(0, show == window.show);
        console.log(1, this);
        $(function(){
            console.log(2, this);
            console.log(3, $(this));
            console.log(4, show == window.show);        function fn(){
                console.log('fn');
            }        setInterval("show()",3000);
        })
    </script>
    </body>
    </html>
      

  4.   

    $(function(){
        
    });
    这个方法只是粗暴的认为是window.onload的加强版,一般做为方法的初始调用,里边不建议混写代码。一般出问题的可能比较多,比如这样:function fn(){
        setInterval(function(){
            console.log('test');
        }, 3000);
    }$(function(){
        fn()
    });
      

  5.   


    这里写错了,
    $(function(){
    function show(){
    alert("123");
    }
    1setInterval(show,2000);
    })
    我定义了,还是不可以的