网页显示时间代码和倒计时代码大全:
<SCRIPT language=JavaScript>
  var enabled = 0;  today = new Date();
  var day;  var date;
  Day()==0)    day = "星期日"
  Day()==1)    day = "星期一"
  Day()==2)    day = "星期二"
  Day()==3)    day = "星期三"
  Day()==4)    day = "星期四"
  Day()==5)    day = "星期五"
  Day()==6)    day = "星期六"
  document.fgColor = " cadet";
  date1 = "<font size=5 face=宋体 color=0000ff>" + (Year()) + "年" + (Month() + 1 ) + "月" + Date() + "日 " + "</font>";
  date2 = "<font size=5 face=宋体 color=ff0000>" + day + "</font>";
  document.write("<center>" + date1.fontsize(2) + date2.fontsize(2) + "</center>");
  </SCRIPT>
<P class=t_msgfont align=center><BR><SPAN id=liveclock 15px? height: 109px; style?="width:"><FONT color=#ff0f00 size=5>17:47:26</FONT></SPAN>
<SCRIPT language=javascript>
function www_helpor_net()
{
var Digital=new Date()
var Hours()
var Minutes()
var Seconds()
if(minutes<=9)
minutes="0"+minutestimeout on t2 timer
if(seconds<=9)
seconds="0"+seconds
myclock="<font size=5 color=0000ff>"+hours+":"+minutes+":"+seconds+"</font>"
if(document.layers){document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}else if(document.all)
liveclock.innerHTML=myclock
setTimeout("www_helpor_net()",1000)
}
www_helpor_net();
//-->
</SCRIPT>
中文显示的时候保存为.js文件再用网页调用出现乱码。用uft-8编码保存.js文件即可解决乱码问题。
---------------------------------------------------------分割线-----------------------------------------------------
实时游走的数字时钟
<script>
function tick() {
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
intHours = Hours();
intMinutes = Minutes();
intSeconds = Seconds();
if (intHours == 0) {
hours = "12:";
xfile = "午夜";
} else if (intHours < 12) {
hours = intHours+":";
xfile = "上午";
} else if (intHours == 12) {
hours = "12:";
xfile = "正午";
} else {
intHours = intHours - 12
hours = intHours + ":";
xfile = "下午";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString = xfile+hours+minutes+seconds;
Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}
load = tick;
</script>
第1步.将下面的代码加入html文件任意需要的地方
<div id="Clock" align="center" ></div>
你可以自行更改样式!
 ---------------------------------------------------------分割线-----------------------------------------------------
显示年月日格式的时间代码
<script language=javascript>
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
document.write(
"<font color=##000000 style='font-size:9pt;font-family: 宋体'> ",
Year(),"年",
Month()+1,"月",
Date(),"日",
Day()+1],
"</font>" );
</script>
 ---------------------------------------------------------分割线-----------------------------------------------------
显示日期,星期,时间格式的代码
<script language="javascript">
<!---
today=new Date();
var hours = Hours();
var minutes = Minutes();
var seconds = Seconds();
var timevalue = "<FONT COLOR=black>" + ((hours >12) ? hours -12 :hours); timevalue +
= ((minutes < 10) ? "<BLINK>
<FONT COLOR=black>:</FONT></BLINK>0" : "<BLINK><FONT COLOR=black>:</FONT></BLINK>") + minutes+"</FONT></FONT>";
timevalue += (hours >= 12) ? "<FONT COLOR=blue><I><B>pm</B></I></FONT>" : "<FONT COLOR=blue><B><I>am</I></B></FONT>";
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray("& lt;font color=RED>星期日","<font color=black>星期一","< font color=black>星期二","<font color=black>星期
三","<font color=black>星期四","<font color=black>星期五","<font color=red>星期六"); document.write
("<font color=black>",Year(),"<font color=black> 年","<font color=black>",Month()+1,"<font color=black>
月","<font color=black>",Date(),"<font color=black>日 </FONT>",Day()+1]," ",timevalue); //-->
</script>
---------------------------------------------------------分割线-----------------------------------------------------

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。