<script src="jquery-1.6.2.min.js" type="text/javascript"></script><script type="text/javascript">

(function($){
$.fn.mymiro=function(options)
{
var mysetting={
x:100,
y:100
}
};

if(options)
{
$.extend(mysetting,options);
}

$(this).hover(function(){
var imageleft=$(this).offset().left;
var imagetop=$(this).offset().top;

var imagewidth=$(this).get(0).offsetWidth;
var imageheight=$(this).get(0).offsetHeight;

});

})(JQuery);

</script>
为什么总是显示Jquery未定义~??

解决方案 »

  1.   

    <script src="jquery-1.6.2.min.js" type="text/javascript"></script><script type="text/javascript">
        
        (function($){
            $.fn.mymiro=function(options)
            {
                var mysetting={
                    x:100,
                    y:100
                }
            };
            
            if(options)
            {
                $.extend(mysetting,options);
            }
            
            $(this).hover(function(){
                var imageleft=$(this).offset().left;
                var imagetop=$(this).offset().top;
                
                var imagewidth=$(this).get(0).offsetWidth;
                var imageheight=$(this).get(0).offsetHeight;
                
            });
            
        })(jQuery);
            
    </script>应该是这样吧?
      

  2.   


    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script type="text/javascript">
        
        (function($){
            $.fn.mymiro=function(options)
            {
                var mysetting={
                    x:100,
                    y:100
                }
            if(options)
            {
                $.extend(mysetting,options);
            }
            
            $(this).hover(function(){
                var imageleft=$(this).offset().left;
                var imagetop=$(this).offset().top;
                
                var imagewidth=$(this).get(0).offsetWidth;
                var imageheight=$(this).get(0).offsetHeight;
                
            });
            };
        })(jQuery);
            
    </script>
      

  3.   

    好了,是我排版搞错了。@hookee,就是你这样的··