不知道错哪里了................................
<script type="text/javascript" src="jquery-1.3.2.js"> </script> 
<script type="text/javascript"> 
(function($){
$.extend({
test : function(){
alert('x');
}
});
})(jQuery);$(document).ready(
function(){
$("#test").test();
}
);
</script> 
</head> 
<body style="padding:20px;"><input id="test" type="text" />4<br></body>

解决方案 »

  1.   


    (function($) {
                $.extend({
                    test: function() {
                        alert('x');
                    }
                });
                $.fn.test1 = function() {
                    this.each(function() {
                        alert(this.value);
                    });
                }
            })(jQuery);        $(document).ready(
        function() {
            $.test();
            $("#test").test1();
        });<input id="test" type="text" value="test1" />去搜索jquery插件的编写方法
      

  2.   

    $.fn.extend写成这样就对了
    那如何写成连式了  
    <script type="text/javascript" src="jquery-1.3.2.js"> </script> 
    <script type="text/javascript"> 
    (function($){
        $.extend({
            test : function(){
                alert('x');
            },
            say : function(){
                alert('hi world!!!');
            }
        });
    })(jQuery);$(document).ready(
        function(){
            $("#test").test().say();
        }
    );
    </script> 
    </head> 
    <body style="padding:20px;"><input id="test" type="text" />4<br></body>
      

  3.   

      (function($) {
                $.extend($.fn,{
                    test: function() {
                        return{say:function(){alert("say");}}
                    }
                });
            })(jQuery);
      

  4.   

    (function($){
    $.fn.extend({
    say1 : function(){
    alert("信");
    return this;
    },
    say2 : function(){
    alert("春");
    return this;
    },
    say3 : function(){
    alert("哥")
    return this;
    },
    say4 : function(){
    alert("好");
    return this;
    },
    say5 : function(){
    alert("买");
    return this;
    },
    say6 : function(){
    alert("火");
    return this;
    },
    say7 : function(){
    alert("车");
    return this;
    },
    say8 : function(){
    alert("票");
    return this;
    }
    });
    })(jQuery);$(document).ready(function(){
    $().say1().say2().say3().say4().say5().say6().say7().say8();
    });