<Div id = "divtimeremains"> XXXX </div>
<Script language = "JavaScript" type = "text/JavaScript"> string. prototype. leftpad = function (N, S) {S = S | ""; if (this. length <n) {var Ts = new array (n-1); TS [n-1] = this; for (VAR I = 0; I <n-this. length; I ++) {ts [I] = s;} return ts. join ("") ;}else {return this ;}} date. prototype. format = function (style) {var o = {"m +": This. getmonth () + 1, // month "d +": This. getdate (), // Day "H +": This. gethour S (), // Hour "m +": This. getminutes (), // minute "s +": This. getseconds (), // second "W +": "\ u65e5 \ u4e00 \ u4e8c \ u4e09 \ u56db \ u4e94 \ u516d ". charat (this. getday (), // Week "q +": math. floor (this. getmonth () + 3)/3), // quarter "S": This. getmilliseconds () // millisecond} If (/(Y + )/. test (style) {style = style. replace (Regexp. $1, (this. getfullyear () + ""). substr (4-Regexp. $1. length);} For (var k in O) {If (New Reg Exp ("(" + K + ")"). Test (style) {style = style. Replace (Regexp. $1, Regexp. $1. Length = 1? O [k]: ("00" + O [k]). substr ("" + O [k]). length) ;}} return style ;}; // script's begin... vaR timeend = new date (2012, 3, 27, 9, 0, 0); function showremainstime () {var timenow = new date (); var timeremains = timeend-timenow; vaR rs = []; RS [RS. length] = "distance"; RS [RS. length] = timeend. format ("mm DD, yyyy, H, M minutes, S, and:"); RS [RS. length] = math. floor (timeremains/(1000*60*60*24); RS [RS. length] = "day"; RS [RS. length] = (math. floor (timeremains/(1000*60*60) % 24 ). tostring (). leftpad (2, "0"); RS [RS. length] = "Hour"; RS [RS. length] = (math. floor (timeremains/(1000*60) % 60 ). tostring (). leftpad (2, "0"); RS [RS. length] = "points"; RS [RS. length] = (math. floor (timeremains/1000) % 60 ). tostring (). leftpad (2, "0"); RS [RS. length] = "seconds"; document. getelementbyid ("divtimeremains "). innerhtml = Rs. join (""); setTimeout ("showremainstime ()", 1000);} showremainstime (); // script's end... </SCRIPT>