百度首页 | 百度空间
 
查看文章
 
【网页特效】时间显示代码 北京时间代码 全球时间表代码
2007-09-20 14:19

【网页特效】时间显示代码 北京时间代码 全球时间表代码

Tag:时间显示代码     北京时间代码   qq空间时间代码     网页时间代码     显示时间代码     空间时间代码     qq时间代码    flash时间代码     时间日期代码    html时间代码     显示时间的代码

1、八种风格的时间日期代码

脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language=javascript author=luxiaoqing><!--
function initArray(){for(i=0;i<initArray.arguments.length;i++)
this[i]=initArray.arguments[i];}var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");today=new Date();hrs=today.getHours();min=today.getMinutes();sec=today.getSeconds();clckh=""+((hrs>12)?hrs-12:hrs);
clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;clck=(hrs>=12)?"下午":"上午";var stnr="";var ns="0123456789";var a="";

//-->

</SCRIPT>
第二步:把如下代码加入区域中
<SCRIPT language=javascript><!--
function getFullYear(d){//d is a date object
yr=d.getYear();if(yr<1000)
yr+=1900;return yr;}document.write("<table width=486>");//don't delete this line

/* 每一段代表一种风格,不需要的删除即可*/

document.write("<TR><TD VALIGN=TOP><P>风格一<P></TD><TD VALIGN=TOP>"+isnDays[today.getDay()]
+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"
+getFullYear(today)+"年<P>");document.write("<TR><TD VALIGN=TOP>风格二<P></TD><TD VALIGN=TOP>"+clckh+":"+clckm
+":"+clcks+""+clck+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格三<P></TD><TD VALIGN=TOP>"
+isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""
+today.getDate()+"日,"+getFullYear(today)+"年 "+clckh+":"+clckm+":"
+clcks+""+clck+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格四<P></TD><TD VALIGN=TOP>"
+(today.getMonth()+1)+"/"+today.getDate()+"/"
+(getFullYear(today)+"").substring(2,4)+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格五:<P></TD><TD VALIGN=TOP>"+hrs+":"+clckm+":"+clcks+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格六:<P></TD><TD>"+today+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格七<P></TD><TD>"+navigator.appName+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格八:<P></TD><TD VALIGN=TOP>"+navigator.appVersion+"<P></TD></TR>");document.write("</table>"); // don't delete this line
//-->

</SCRIPT>

2、title显示日期代码

脚本说明:
把如下代码加入<body>区域中:
<script language="JavaScript1.2">
<!--hide
var isnMonth = new
Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDay = new
Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
today = new Date () ;
Year=today.getYear();
Date=today.getDate();
if (document.all)
document.title="今天是: "+Year+"年"+isnMonth[today.getMonth()]+Date+"日"+isnDay[today.getDay()]
//--hide-->
</script>

3、实况HTML时钟Script代码

<!--One step to installing this script-->

<!--1) Copy everything below, and paste in BODY section of page-->

<span id=tick2>

</span>

<script>

<!--

/*By George Chiang (WA's JavaScript tutorial)

http://wsabstract.com

Credit MUST stay intact for use*/

function show2(){

if (!document.all)

return

var Digital=new Date()

var hours=Digital.getHours()

var minutes=Digital.getMinutes()

var seconds=Digital.getSeconds()

var dn="AM"

if (hours>12){

dn="PM"

hours=hours-12

}

if (hours==0)

hours=12

if (minutes<=9)

minutes="0"+minutes

if (seconds<=9)

seconds="0"+seconds

var ctime=hours+":"+minutes+":"+seconds+" "+dn

tick2.innerHTML="<b style='font-size:22;color:blue;'>"+ctime+"</b>"

setTimeout("show2()",1000)

}

window.onload=show2

//-->

</script>

4、非常酷的时钟,图片制作精美,还有日期显示代码

脚本说明:
把如下代码加入<body>区域中
<STYLE type=text/css>.light {
FILTER: Light
}
.date {
COLOR: #000000; FONT-FAMILY: "Geneva", "Arial", "Helvetica", "san-serif"; FONT-SIZE: 12px; FONT-WEIGHT: bold; TEXT-ALIGN: center
}
</STYLE>

<SCRIPT>
function setLights(){
var sx=Math.cos(slightDir)*slightr;
var sy=Math.sin(slightDir)*slightr;
var mx=Math.cos(mlightDir)*mlightr;
var my=Math.sin(mlightDir)*mlightr;
var hx=Math.cos(hlightDir)*hlightr;
var hy=Math.sin(hlightDir)*hlightr;
sconDiv.filters.Light.clear();
sconDiv.filters.Light.addCone(sx+72,sy+72,1,73,72,215,255,5,20,1);
sconDiv.filters.Light.addCone(mx+72,my+72,1,73,72,255,10,0,20,2);
sconDiv.filters.Light.addCone(hx+72,hy+72,1,73,72,15,100,255,20,4);
sconDiv.filters.Light.addAmbient(155,155,155,100);
}

function timeGo(){
var tt=new Date();
slightDir=(tt.getSeconds())/60*6.28-1.57;
mlightDir=(tt.getMinutes())/60*6.28-1.57;
hlightDir=(tt.getHours())/12*6.28-1.57+mlightDir/6.28*0.52+0.05;
dateDiv.innerText=tt.getMonth()+1+"-"+tt.getDate();
setLights();
}

function InitClock(){
slightr=110;
mlightr=90;
hlightr=60;
timeGo();
setInterval("timeGo()",1000);
}
window.onload=InitClock;
</SCRIPT>

<DIV id=clockDiv
style="HEIGHT: 222px; LEFT: 145px; POSITION: absolute; TOP: 12px; WIDTH: 233px; Z-INDEX: 1">
<DIV class=light id=sconDiv
style="HEIGHT: 70px; LEFT: 27px; POSITION: absolute; TOP: 22px; WIDTH: 70px; Z-INDEX: 1"><IMG
height=144 src="images/clockm.gif" width=144></DIV><IMG height=200
src="images/clock2.gif" width=200>
<DIV id=clLayer
style="HEIGHT: 25px; LEFT: 88px; POSITION: absolute; TOP: 80px; WIDTH: 25px; Z-INDEX: 2"><IMG
height=26 src="images/clockd.gif" width=26></DIV>
<DIV class=date id=dateDiv
style="HEIGHT: 16px; LEFT: 85px; POSITION: absolute; TOP: 178px; WIDTH: 32px; Z-INDEX: 3">12-2</DIV></DIV>

5、时钟显示在任意指定位置代码

脚本说明:
第一步:把如下代码加入<body>区域中:
   <span id=liveclock style=position:absolute;left:250px;top:122px;; width: 109px; height: 15px>
</span>     (这里可以调整时钟的方位。调用脚本时去掉括号中内容)
<SCRIPT language=javascript>
<!--

function show5(){if(!document.layers&&!document.all)
return
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM"
if(hours>12){dn="PM"
hours=hours-12
}if(hours==0)
hours=12
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
//change font size here to your desire
myclock="<font size='5' face='Arial'><b><font size='1'>Current Time:</font></br>"+hours+":"+minutes+":"
+seconds+" "+dn+"</b></font>"
if(document.layers){document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}else if(document.all)
liveclock.innerHTML=myclock
setTimeout("show5()",1000)
}
//>
</SCRIPT>

第二步:把<body>中的内容改为
<body bgcolor="#fef4d9" ONLOAD=show5()>

页面背景花瓣效果代码>>

发生梦幻变化图片特效>>

...




类别:Javascript | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请输入下图中的四位验证码,字母不区分大小写。
看不清?
 

     

©2008 Baidu