<html>
<hand>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">
</script>
</hand>
<body> <!-- 本代码没有加入juqery,请在使用前你手动加入juqery库 -->
<span class="showtime" nowtime="2100/03/20 00:00:00"> d</span>
<span class="showtime" nowtime="2100/03/10 00:00:00" > w </span>
<script>
$(".showtime").click(function(){
alert(2);
})
/*时间倒计时 star */
$(".showtime").click(function(){
var _this = $(this);
var nowtime = _this.attr('nowtime');
var EndTime= new Date(nowtime);
var NowTime = new Date();
var t =EndTime.getTime() - NowTime.getTime();
var d=Math.floor(t/1000/60/60/24);
var h=Math.floor(t/1000/60/60%24);
var m=Math.floor(t/1000/60%60);
var s=Math.floor(t/1000%60);
var timestr = '还剩'+d + '天' + h + '时' + m + '分' + s + '秒'; _this.html(timestr);
});
function doRtime(){
$(".showtime").trigger("click");
} setInterval(doRtime,0);
/*时间倒计时 end */
</script> </body>
</html>