(function(){var 
// Will speed up references to window, and allows munging its name.
window = this,
// Will speed up references to undefined, and allows munging its name.
undefined,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$, jQuery = window.jQuery = window.$ = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context );
}, // A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
// Is it a simple selector
isSimple = /^.[^:#\[\.,]*$/;jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
// Make sure that a selection was provided
selector = selector || document;
}这个函数为什么没有名字,怎么调用它呢

解决方案 »

  1.   

    var sayHello=function(){
      alert("Hello");
    };
    sayHello();
    还有上面的这种情况,将匿名函数赋给一个变量,然后通过变量调用。
      

  2.   


    (function(id){
        alert(id);//结果为 2
    })(2);
      

  3.   

    自运行函数即定义了函数之后直接运行用途1:(原理,非主要用途)
    (function(id){
        alert(id);//结果为 2
    })(2);
    用途2:(旧浏览器中不存在undefined关键字,用这种方法定义)
    (function(undefined){
        alert(undefined);
    })();用途3:(变量作用域, 用来防止导入不同js文件中的变量重名)
    (function(undefined){
        var a = 1;
    })();
    alert(a);// undefined
      

  4.   

    你这个是 jQuery 1.3.x的源码吧???
      

  5.   

    http://www.hxlwg.com
      

  6.   

    js 方法的参数可以是 function, 你在调用它时就可以给他传一个匿名函数
      

  7.   

    (function(){})()
    他就是靠外面的这个括号运行的。
    ()在js里的function里就表示执行。
      

  8.   

    有种函数叫匿名函数,有些时候调用某个函数没有必要指定名字时就可以使用。
    形如(function(){
    /do something here*/
    })();等价于匿名函数=function(){
    /do something here*/
    };//定义
    匿名函数();//调用“匿名函数”可以换成任何你要的函数名字,这样写就很熟悉了,你会发现很多时候其实就在使用它。
      

  9.   

    jQuery中的$("document").ready(function(){});的简写
      

  10.   

    没有名字的函数,可以通过赋值,传给一个变量比如:var theFunction = function() {
        // ...
    };然后,再通过变量名调用
    theFunction();
    -------------------------------也可以定义完,马上一次性调用
    (function() {
        // ...
    })();
      

  11.   

    javascript 里面的东东。可以用它创建对象,也可以创建一个函数。