Phiên bản đầy đủ: jsB@nk » Ứng dụng » Công cụ xuất » Tạo thời gian đếm ngược
URL: https://www.javascriptbank.com/countdown-creator-script.html
Hiệu ứng này sẽ xuất ra một đoạn mã thông báo thời gian đếm ngược đối với một thời điểm ngày tháng mà bạn muốn. Rất hữu ích.
Phiên bản đầy đủ: jsB@nk » Ứng dụng » Công cụ xuất » Tạo thời gian đếm ngược
URL: https://www.javascriptbank.com/countdown-creator-script.html
<SCRIPT language=JavaScript><!-- Beginvar email = GetCookie('email_address');if (email == null) {email = 'your email here';}function getCookieVal (offset) {var endstr = document.cookie.indexOf (";", offset);if (endstr == -1)endstr = document.cookie.length;return unescape(document.cookie.substring(offset, endstr));}function GetCookie (name) {var arg = name + "=";var alen = arg.length;var clen = document.cookie.length;var i = 0;while (i < clen) {var j = i + alen;if (document.cookie.substring(i, j) == arg)return getCookieVal (j);i = document.cookie.indexOf(" ", i) + 1;if (i == 0)break;}return null;}function SetCookie (name, value) {var argv = SetCookie.arguments;var argc = SetCookie.arguments.length;var expires = (argc > 2) ? argv[2] : null;var path = (argc > 3) ? argv[3] : null;var domain = ".internet.com";// (argc > 4) ? argv[4] : null;var secure = (argc > 5) ? argv[5] : false;document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires=" +expires.toGMTString())) +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain)) +((secure == true) ? "; secure" : "");}function checkCodeMail() {invalid = ""email = document.mail.user.value;code = document.mail.source.value;if (code == "") {invalid += "Before you can send your code to yourself you need to ";invalid += "follow the instructions above to output the code. When "invalid += "the code has been generated, click \"Done\" to email it!\r\n\r\n";}if (email.indexOf("@")<1 || email == "your email here" || email == "") {invalid += "Invalid email address! Be sure that in your email address ";invalid += "you included your Username, the '@' Sign, and the Domain Name.";}if (invalid == "") {doAd();return true;}else {alert(invalid);return false;}}function doAd() {pathname = location.pathname;myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';var largeExpDate = new Date ();largeExpDate.setTime(largeExpDate.getTime() + (24 * 3600 * 1000));SetCookie('email_address',email,largeExpDate,myDomain);page = "http://javascript.internet.com/sent.html?" + email;window.open(page, "AdWindow", "width=515,height=150");return true;}function uncode() {smut="<";replacewords="< ";txt=document.mail.source2.value;tstx="";space=replacewords.indexOf(" ");wrd=replacewords.substring(0,space);wrdl=wrd.lengthreplacewords=replacewords.substring(space+1,replacewords.length);while (txt.indexOf(wrd)>-1){space=txt.indexOf(wrd);txt=txt.substring(0,space)+smut+txt.substring((space+wrdl),txt.length);}smut=">";replacewords="> ";space=replacewords.indexOf(" ");wrd=replacewords.substring(0,space);wrdl=wrd.lengthreplacewords=replacewords.substring(space+1,replacewords.length);while (txt.indexOf(wrd)>-1){space=txt.indexOf(wrd);txt=txt.substring(0,space)+smut+txt.substring((space+wrdl),txt.length);}document.mail.source2.value=txt;}// End --></SCRIPT><!-- Now it's time for the *REAL* code generator to begin.... --><SCRIPT language=JavaScript><!-- This script and many more are available free online at --><!-- The JavaScript Source!! http://javascript.internet.com --><!-- Beginfunction generate(form){for (var q = 0; q < 12; q++) {if (document.me.m.options[document.me.m.selectedIndex].value == q) {var m2 = q+1}var txt = '<!-- THREE STEPS TO INSTALL DATE COUNTDOWN:\r\n\r\n'+ ' 1. Paste the first into the HEAD of your HTML document\r\n'+ ' 2. Code the OnLoad event handler into the BODY tag\r\n'+ ' 3. Add the last code into the BODY of your HTML document -->\r\n\r\n'+ '<!-- STEP ONE: Copy this code into the HEAD of your HTML document -->\r\n\r\n'+ '<HEAD>\r\n\r\n<SCRIPT LANGUAGE="JavaScript">\r\n\r\n'+ '<!-- This script and many more are available free online at -->\r\n'+ '<!-- The JavaScript Source!! http://javascriptbank.com -->\r\n\r\n'+ '<!-- Begin\r\n'+ 'var Temp2;\n'+ 'var timerID = null;\n'+ 'var timerRunning = false;\n'+ 'function arry() {\n'+ 'this.length = 12;\n'+ 'this[0] = 31;\n'+ 'this[1] = 28;\n'+ 'this[2] = 31;\n'+ 'this[3] = 30;\n'+ 'this[4] = 31;\n'+ 'this[5] = 30;\n'+ 'this[6] = 31;\n'+ 'this[7] = 31;\n'+ 'this[8] = 30;\n'+ 'this[9] = 31;\n'+ 'this[10] = 30;\n'+ 'this[11] = 31;\n'+ '}\n'+ 'var date = new arry();\n'+ '\n'+ 'function stopclock() {\n'+ 'if(timerRunning)\n'+ 'clearTimeout(timerID);\n'+ 'timerRunning = false;\n'+ '}\n'+ '\n'+ 'function startclock() {\n'+ 'stopclock();\n'+ 'showtime();\n'+ '}\n'+ '\n'+ 'function showtime() {\n'+ 'now = new Date();\n'+ 'var CurMonth = now.getMonth();\n'+ 'var CurDate = now.getDate();\n'+ 'var CurYear = now.getFullYear();\n'+ 'now = null;\n'+ 'if ('+document.me.d.options[document.me.d.selectedIndex].value+' < CurDate) {\n'+ 'CurDate -= date[CurMonth]; CurMonth++;\n'+ '}\n'+ 'if ('+document.me.m.options[document.me.m.selectedIndex].value+' < CurMonth) {\n'+ 'CurMonth -= 12; CurYear++;\n'+ '}\n'+ '\n'+ 'var Yearleft = '+document.me.y.options[document.me.y.selectedIndex].value+' - CurYear;\n'+ 'var Monthleft = '+document.me.m.options[document.me.m.selectedIndex].value+' - CurMonth;\n'+ 'var Dateleft = '+document.me.d.options[document.me.d.selectedIndex].value+' - CurDate;\n'+ '\n'+ 'document.dateform.a.value = Yearleft;\n'+ 'document.dateform.b.value = Monthleft;\n'+ 'document.dateform.c.value = Dateleft;\n'+ '\n'+ 'timerID = setTimeout("showtime()",1000);\n'+ 'timerRunning = true;\n'+ '}\n'+ '/\/ End -->\r\n<\/script>\r\n'+ '<\/H'+'EAD>\r\n\r\n'+ '<!-- STEP TWO: Add the OnLoad event handler to the BODY tag -->\r\n\r\n'+ '<BO' + 'DY Onload="startclock()">\r\n\r\n'+ '<!-- STEP THREE: Insert this code into the BODY of your HTML document -->\r\n\r\n'+ '<form name=dateform>Only \n'+ '<input type=text name=a size=2 value=""> years, \n'+ '<input type=text name=b size=2 value=""> months, and \n'+ '<input type=text name=c size=2 value=""> days left until '+ m2+'/'+document.me.d.options[document.me.d.selectedIndex].value+'/'+ document.me.y.options[document.me.y.selectedIndex].value+'</fo'+'rm>\r\n\r\n'+ '<'+'!-- Script Size: 1.95 KB --'+'>';}document.mail.source.value=txt;document.mail.source2.value=txt;uncode();}// End --></SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<FORM name=me><SELECT name=m> <OPTION value=0 selected>January<OPTION value=1>February<OPTION value=2>March<OPTION value=3>April<OPTION value=4>May<OPTION value=5>June<OPTION value=6>July<OPTION value=7>August<OPTION value=8>September<OPTION value=9>October<OPTION value=10>November<OPTION value=11>December</OPTION></SELECT> <SELECT name=d> <OPTION value=1 selected>1<OPTION value=2>2<OPTION value=3>3<OPTION value=4>4<OPTION value=5>5<OPTION value=6>6<OPTION value=7>7<OPTION value=8>8<OPTION value=9>9<OPTION value=10>10<OPTION value=11>11<OPTION value=12>12<OPTION value=13>13<OPTION value=14>14<OPTION value=15>15<OPTION value=16>16<OPTION value=17>17<OPTION value=18>18<OPTION value=19>19<OPTION value=20>20<OPTION value=21>21<OPTION value=22>22<OPTION value=23>23<OPTION value=24>24<OPTION value=25>25<OPTION value=26>26<OPTION value=27>27<OPTION value=28>28<OPTION value=29>29<OPTION value=30>30<OPTION value=31>31</OPTION></SELECT> <SELECT name=y> <OPTION value=1999 selected>1999<OPTION value=2000>2000<OPTION value=2001>2001<OPTION value=2002>2002<OPTION value=2003>2003<OPTION value=2004>2004<OPTION value=2005>2005<OPTION value=2006>2006<OPTION value=2007>2007<OPTION value=2008>2008<OPTION value=2009>2009</OPTION></SELECT> <BR><INPUT onclick=generate() type=button value="Generate Code"> </FORM></CENTER> <CENTER> <FORM name=mail onsubmit="return checkCodeMail()" action=/cgi-bin/code-mail.cgi method=post><INPUT type=hidden value="Countdown Creator" name=scriptname> <TABLE cellPadding=4 width=400 bgColor=#dedfdf border=2> <TBODY> <TR> <TD align=middle><TEXTAREA name=source rows=12 cols=80></TEXTAREA><BR><INPUT type=hidden name=source2></TD></TR></TBODY></TABLE></FORM><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->