`
BabyDuncan
  • 浏览: 574065 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Jquery和Prototype共存的方法

阅读更多
方式一:
Java代码
   
<html>  
<head>  
   <script src="prototype.js"></script>  
   <script src="jquery.js"></script>  
   <script>  
     jQuery.noConflict();  
       
     // Use jQuery via jQuery(...)  
     jQuery(document).ready(function(){  
       jQuery("div").hide();  
     });  
       
     // Use Prototype with $(...), etc.  
     $('someid').style.display = 'none';  
   </script>  
</head>  
<body></body>  
</html> 


<html>
<head>
   <script src="prototype.js"></script>
   <script src="jquery.js"></script>
   <script>
     jQuery.noConflict();
    
     // Use jQuery via jQuery(...)
     jQuery(document).ready(function(){
       jQuery("div").hide();
     });
    
     // Use Prototype with $(...), etc.
     $('someid').style.display = 'none';
   </script>
</head>
<body></body>
</html>

方式二:
Java代码
<html>  
<head>  
   <script src="prototype.js"></script>  
   <script src="jquery.js"></script>  
   <script>  
     var $j = jQuery.noConflict();  
       
     // Use jQuery via $j(...)  
     $j(document).ready(function(){  
       $j("div").hide();  
     });  
       
     // Use Prototype with $(...), etc.  
     $('someid').style.display = 'none';  
   </script>  
</head>  
<body></body>  
</html> 

<html>
<head>
   <script src="prototype.js"></script>
   <script src="jquery.js"></script>
   <script>
     var $j = jQuery.noConflict();
    
     // Use jQuery via $j(...)
     $j(document).ready(function(){
       $j("div").hide();
     });
    
     // Use Prototype with $(...), etc.
     $('someid').style.display = 'none';
   </script>
</head>
<body></body>
</html>

方式三:
Java代码
<html>  
<head>  
   <script src="prototype.js"></script>  
   <script src="jquery.js"></script>  
   <script>  
     jQuery.noConflict();  
       
     // Put all your code in your document ready area  
     jQuery(document).ready(function($){  
       // Do jQuery stuff using $  
       $("div").hide();  
     });  
       
     // Use Prototype with $(...), etc.  
     $('someid').style.display = 'none';  
   </script>  
</head>  
<body></body>  
</html> 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics