谷百优大赛离结束越来越近了,我的参赛站( http://www.qigun.com )已经挂上了倒计时的代码,自我感觉还不错,特拿来分享:
调用:<script src="放置路径/gubaiyou.js"></script>
将代码放于你想放的位置,
gubaiyou.js代码:
document.writeln("<!--done-->");
document.writeln("<div class=\"newsItem\">");
document.writeln(" <b><align=center><font color=red size=4>谷百优大赛结束倒计时<\/b><\/font> ");
document.writeln("");
document.writeln("<span id=\"span_dt_dt\" style=\'align=center no:1px solid black;background-color:#FFFFFF\' ><\/span> ");
document.writeln("");
document.writeln("<SCRIPT language=javascript> ");
document.writeln("<!-- ");
document.writeln("\/\/document.write(\"\"); ");
document.writeln("");
document.writeln("function show_date_time(){ ");
document.writeln("window.setTimeout(\"show_date_time()\", 1000); ");
document.writeln("BirthDay=new Date(\"6-1-2009\");\/\/这个日期是可以修改的 ");
document.writeln("today=new Date(); ");
document.writeln("timeold=(BirthDay.getTime()-today.getTime()); ");
document.writeln("sectimeold=timeold\/1000 ");
document.writeln("secondsold=Math.floor(sectimeold); ");
document.writeln("msPerDay=24*60*60*1000 ");
document.writeln("e_daysold=timeold\/msPerDay ");
document.writeln("daysold=Math.floor(e_daysold); ");
document.writeln("e_hrsold=(e_daysold-daysold)*24; ");
document.writeln("hrsold=Math.floor(e_hrsold); ");
document.writeln("e_minsold=(e_hrsold-hrsold)*60; ");
document.writeln("minsold=Math.floor((e_hrsold-hrsold)*60); ");
document.writeln("seconds=Math.floor((e_minsold-minsold)*60); ");
document.writeln("span_dt_dt.innerHTML=\"<b><align=center><font color=00CC00 size=4>\"+daysold+\"天\"+hrsold+\"小时\"+minsold+\"分\"+seconds+\"秒\"+\"<\/b><br><\/font>\" ; ");
document.writeln("");
document.writeln("} ");
document.writeln("");
document.writeln("show_date_time(); ");
document.writeln("");
document.writeln("\/\/--> ");
document.writeln("<\/SCRIPT>");
站长网第五期SEO培训报名地址: http://bbs.admin5.com/thread-917492-1-1.html