用来生成倒计时JS代码的脚本
要完成此效果需要两个步骤
第一步:把如下代码加入到<head>区域中
<SCRIPT language=javascript>
<!--
function generate(form){for(var
q=0;q<12;q++){if(document.me.m.options[document.me.m.selectedIndex].val
ue==q){var m2=q+1
}var txt='<!-- 要完成此效果需要三个步骤:\r\n\r\n'
+' 1. 将第一部分粘贴到HTML的HEAD区\r\n'
+' 2. 将OnLoad事件加入BODY标签内\r\n'
+' 3. 将最后一部分代码加入BODY区 -->\r\n\r\n'
+'<!-- 第一步: 将如下代码加入到HEAD区域中-->\r\n\r\n'
+'<HEAD>\r\n\r\n<SCRIPT LANGUAGE="JavaScript">\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'
+'<!-- 第二步:把OnLoad事件加在BODY标记里 -->\r\n\r\n'
+'<BO'+'DY Onload="startclock()">\r\n\r\n'
+'<!-- 第三步:把如下代码加入到BODY区域中 -->\r\n\r\n'
+'<form name=dateform>距离'
+m2+'/'+document.me.d.options[document.me.d.selectedIndex].value+'/'
+document.me.y.options[document.me.y.selectedIndex].value
+'还有\n'
+'<input type=text name=a size=2 value="">年\n'
+'<input type=text name=b size=2 value="">月\n'
+'<input type=text name=c size=2 value="">天\n'
+'</fo'+'rm>\r\n\r\n'
+'<'+'!-- 代码长度: 1.95 KB --'+'>'
;}document.mail.source.value=txt;document.mail.source2.value=txt;}
//-->
</SCRIPT>
第二步:把如下代码加入到<body>区域中
<table border=5 bordercolor=#000000 borderlight=green>
|