<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>
記得要在載入完各js庫后才能用jQuery.noConflict()進行重載哦,如例子中的prototype和jquery。
當然我們也可以不使用其默認的名字空間,比如我喜歡使用 $j() 而不是 jQuery() 。
Js代碼
var $j = jQuery.noConflict();
$j(document).ready(function(){
$j(”div”).hide();
});
下一篇 教你們如何看一個IDC的綜合實力