把相应的JQUERY代码天下如下代码:
<script type="text/javascript"> jQuery.noConflict(); </script>
示例原jquery代码:
<script type="text/javascript" src="http://www.juhutang.com/ /jquery-1.4.2.min.js"></script>
<script type="text/javascript"> $(function() { countDown("2222/02/02 23:59:59", "#demo01 .day", "#demo01 .hour", "#demo01 .minute", "#demo01 .second"); countDown("2222/02/02 22:59:59", null, "#demo02 .hour", "#demo02 .minute", "#demo02 .second"); }); function countDown(time, day_elem, hour_elem, minute_elem, second_elem) { //if(typeof end_time == "string") var end_time = new Date(time).getTime(), //月份是实际月份-1 //current_time = new Date().getTime(), sys_second = (end_time - new Date().getTime()) / 1000; var timer = setInterval(function() { if (sys_second > 0) { sys_second -= 1; var day = Math.floor((sys_second / 3600) / 24); var hour = Math.floor((sys_second / 3600) % 24); var minute = Math.floor((sys_second / 60) % 60); var second = Math.floor(sys_second % 60); day_elem && $(day_elem).text(day); //计算天 $(hour_elem).text(hour < 10 ? "0" + hour: hour); //计算小时 $(minute_elem).text(minute < 10 ? "0" + minute: minute); //计算分 $(second_elem).text(second < 10 ? "0" + second: second); // 计算秒 } else { clearInterval(timer); } }, 1000); } </script>
更改成如下代码:
<script type="text/javascript" src="http://www.juhutang.com/ /jquery-1.4.2.min.js"></script> <script type="text/javascript"> jQuery.noConflict(); </script> <script type="text/javascript"> jQuery(function(){ countDown("2014/7/05 00:00:00","#demo01 .day","#demo01 .hour","#demo01 .minute","#demo01 .second"); countDown("2014/7/05 04:00:00","#demo02 .day","#demo02 .hour","#demo02 .minute","#demo02 .second"); countDown("2014/7/06 00:00:00","#demo03 .day","#demo03 .hour","#demo03 .minute","#demo03 .second"); countDown("2014/7/06 04:00:00","#demo04 .day","#demo04 .hour","#demo04 .minute","#demo04 .second"); }); function countDown(time,day_elem,hour_elem,minute_elem,second_elem){ //if(typeof end_time == "string") var end_time = new Date(time).getTime(),//月份是实际月份-1 //current_time = new Date().getTime(), sys_second = (end_time-new Date().getTime())/1000; var timer = setInterval(function(){ if (sys_second > 0) { sys_second -= 1; var day = Math.floor((sys_second / 3600) / 24); var hour = Math.floor((sys_second / 3600) % 24); var minute = Math.floor((sys_second / 60) % 60); var second = Math.floor(sys_second % 60); day_elem && jQuery(day_elem).text(day);//计算天 jQuery(hour_elem).text(hour<10?"0"+hour:hour);//计算小时 jQuery(minute_elem).text(minute<10?"0"+minute:minute);//计算分 jQuery(second_elem).text(second<10?"0"+second:second);// 计算秒 } else { clearInterval(timer); } }, 1000); } </script>
这些代码一定要放到discuz的common.js后面执行哦。。。。