JavaScript实例集Word文件下载.docx
- 文档编号:15329827
- 上传时间:2022-10-29
- 格式:DOCX
- 页数:64
- 大小:36.55KB
JavaScript实例集Word文件下载.docx
《JavaScript实例集Word文件下载.docx》由会员分享,可在线阅读,更多相关《JavaScript实例集Word文件下载.docx(64页珍藏版)》请在冰豆网上搜索。
document.write(month);
月"
document.write(date);
日"
}
if(navigator.appVersion.indexOf("
MSIE"
)!
=-1)
document.write(year);
document.write(month);
document.write(date);
if(todayDate.getDay()==5)document.write("
星期五"
if(todayDate.getDay()==6)document.write("
星期六"
if(todayDate.getDay()==0)document.write("
星期日"
if(todayDate.getDay()==1)document.write("
星期一"
if(todayDate.getDay()==2)document.write("
星期二"
if(todayDate.getDay()==3)document.write("
星期三"
if(todayDate.getDay()==4)document.write("
星期四"
//-->
动态数字时钟1
scriptlanguage="
JavaScript"
>
functionTime(){
/*由于IE与Netscape对JavaScript的解释不同,造成浏览的效果不同,所以要分别写代码。
判断一下用户所使用的浏览器,如果两者都不是,就返回。
*/
if(!
document.layers&
&
document.all)
return
varTimer=newDate()
varhours=Timer.getHours()
varminutes=Timer.getMinutes()
varseconds=Timer.getSeconds()
varnoon="
AM"
if(hours>
12){
noon="
PM"
hours=hours-12
}
if(hours==0)
hours=12
if(minutes<
=9)
minutes="
0"
+minutes
if(seconds<
seconds="
+seconds
//changefontsizeheretoyourdesire
myclock="
fontsize='
4'
face='
Arial'
color=blue>
+hours+"
:
+minutes+"
+seconds+"
"
+noon+"
/b>
/font>
if(document.layers){//浏览器是Netscape
document.layers.position.document.write(myclock)
document.layers.position.document.close()
elseif(document.all)
position.innerHTML=myclock
setTimeout("
Time()"
1000)//每1000毫秒,调用一次Time函数,即一秒动一次。
/script>
spanid="
position"
style="
position:
absolute;
left:
441px;
top:
190px;
width:
128px;
height:
30px"
/span>
动态数字时钟2
head>
/head>
javascript"
vardn
c1=newImage();
c1.src="
img/c1.gif"
c2=newImage();
c2.src="
img/c2.gif"
c3=newImage();
c3.src="
img/c3.gif"
c4=newImage();
c4.src="
img/c4.gif"
c5=newImage();
c5.src="
img/c5.gif"
c6=newImage();
c6.src="
img/c6.gif"
c7=newImage();
c7.src="
img/c7.gif"
c8=newImage();
c8.src="
img/c8.gif"
c9=newImage();
c9.src="
img/c9.gif"
c0=newImage();
c0.src="
img/c0.gif"
cb=newImage();
cb.src="
img/cb.gif"
cam=newImage();
cam.src="
img/cam.gif"
cpm=newImage();
cpm.src="
img/cpm.gif"
functionextract(h,m,s,type){
if(!
document.images)//如果当前窗口不存在images对象,就返回。
return
if(h<
=9){//当h<
9时,就在小时前输出一个黑背景,再输出ch.src图。
document.images.a.src=cb.src
document.images.b.src=eval("
c"
+h+"
.src"
else{
document.images.a.src=eval("
+Math.floor(h/10)+"
+(h%10)+"
if(m<
=9){//当m<
=9时,就在分钟前输出一个0,再输出cm.src图。
document.images.d.src=c0.src
document.images.e.src=eval("
+m+"
document.images.d.src=eval("
+Math.floor(m/10)+"
+(m%10)+"
if(s<
=9){
document.g.src=c0.src
document.images.h.src=eval("
+s+"
document.images.g.src=eval("
+Math.floor(s/10)+"
+(s%10)+"
if(dn=="
)document.j.src=cam.src
elsedocument.images.j.src=cpm.src
functionshow(){
document.images)
varDigital=newDate()
varhours=Digital.getHours()
varminutes=Digital.getMinutes()
varseconds=Digital.getSeconds()
dn="
if((hours>
=12)&
(minutes>
=1)||(hours>
=13)){
hours=hours-12
if(hours==0)
hours=12
extract(hours,minutes,seconds,dn)
show()"
1000)//1秒调用一次show函数。
body****>
正文中
onLoad="
imgsrc="
cb.gif"
name="
a"
b"
colon.gif"
d"
e"
f"
g"
h"
cam.gif"
j"
辨别浏览器
之间//navigater是浏览器对象,appName是提供字符串形式的浏览器名称,appVersion是反映浏览器的版本号。
CENTER>
您的浏览器是:
+navigator.appName+"
+navigator.appVersion+"
//-->
分时问候
varmess1="
;
center>
fontcolor='
#0000FF'
size=4>
b>
day=newDate()
hr=day.getHours()
if((hr>
=0)&
(hr<
=4))
mess1="
深夜了,注意身体,该休息了!
=4)&
7))
清晨好,这麽早就上网呀?
!
=7)&
12))
早上好,一天之际在于晨,又是美好的一天!
=12)&
=13))
该吃午饭啦!
有什麽好吃的?
=13)&
=17))
外面的天气很热吧?
心静自然凉!
=17)&
=18))
太阳落山了!
快看看夕阳吧!
if((hr>
=18)&
=19))
吃过晚饭了吗?
=19)&
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- JavaScript 实例