#1 浮動時鐘 (右上角) - 蛙 (Administrator) 發表於 17-5-2012 21:20
<P><FONT color=#0000ff size=3>如不能顯示語法效果可貼去本站</FONT><A href="http://www.bunbun000.com/html/index.htm" target=_blank><FONT color=red size=3>語法測試板</FONT></A><FONT color=#0000ff size=3>試看</FONT></P><P><FONT color=#0000ff size=3></FONT> </P>
<P><FONT color=#0000ff size=3></FONT> </P>
<P><FONT color=#0000ff size=3></FONT> </P>
<P><FONT color=blue><style type="text/css"><BR>#pane {position: absolute; visibility: hidden;}<BR></style><BR><style fprolloverstyle>A:hover {color: red; font-weight: bold}<BR></style></FONT></P>
<P><FONT color=blue><script language="JavaScript"><BR><!--<BR>var TimerOrClock = "clock";</FONT></P>
<P><FONT color=blue>//layer height<BR>var layerH = 30; //時鐘顯示的高度</FONT></P>
<P><FONT color=blue>//layer width<BR>var layerW = 180; //時鐘顯示的寬度</FONT></P>
<P><FONT color=blue>//location of the layer on the page:<BR>//top_left, top_right, "bottom_left", "bottom_right"<BR>var location = "top_right"; </FONT></P>
<P><FONT color=blue>//background color of the layer:<BR>//transparent - inherits the background of the page;<BR>//any color as a word or in hexadecimal<BR>var bgcolor = "#000000"; //顯示背景顏色</FONT></P>
<P><FONT color=blue>//font color<BR>var text = "#FF0000"; //顯示文字顏色</FONT></P>
<P><FONT color=blue>//font size<BR>var font_size = 3;</FONT></P>
<P><FONT color=blue>//font face<BR>var font_face = "新明細體";</FONT></P>
<P><FONT color=blue>//your words<BR>var message = "現在時間:";</FONT></P>
<P><FONT color=blue>/***************** DO NOT EDIT BELOW THIS LINE ***************/<BR>var layer;<BR>var IE = document.all;<BR>var updateWatch;<BR>var start = 0;</FONT></P>
<P><FONT color=blue>function writeTime(time)<BR>{<BR> var color, size, face, out;<BR> <BR> color = (text)? text : "black";<BR> size = (font_size)? font_size : 2;<BR> face = (font_face)? font_face : "Arial";<BR> <BR> out = "<font face = \"" + face + "\" size = " + size + " color = \"" + color + "\">";<BR> out += (message)? message : "";</FONT></P>
<P><FONT color=blue> if(!IE)<BR> out += " " + time + "</font>";<BR> else<BR> out += time + "</font>";<BR> <BR> if(IE)<BR> layer.innerHTML = "<table width=\"100%\" height=\"100%\"><tr><td valign=\"middle\" align=\"center\">" + out + "</td></tr></table>";<BR> else<BR> { <BR> layer.document.open();<BR> layer.document.write("<br> " + "<b>" + out + "</b>"<BR> layer.document.close();<BR> }<BR>}</FONT></P>
<P><FONT color=blue>function clock()<BR>{<BR> var hh, mm, ss;<BR> var time, d, ampm = "am";</FONT></P>
<P><FONT color=blue> d = new Date();<BR> <BR> hh = d.getHours();<BR> mm = d.getMinutes();<BR> ss = d.getSeconds();<BR> <BR> if(hh > 12)<BR> {<BR> hh -= 12;<BR> ampm = "pm";<BR> } <BR> <BR> hh = (hh < 10)? "0" + hh : hh;<BR> mm = (mm < 10)? "0" + mm : mm;<BR> ss = (ss < 10)? "0" + ss : ss;</FONT></P>
<P><FONT color=blue> time = hh + ":" + mm + ":" + ss + " " + ampm;<BR> <BR> writeTime(time);<BR>}</FONT></P>
<P><FONT color=blue>function timer()<BR>{<BR> var hh, mm, ss;<BR> var time;<BR> <BR> hh = parseInt("0" + (start / 3600), 10);<BR> mm = parseInt("0" + ((start - (hh * 3600)) / 60), 10);<BR> ss = start - (hh * 3600) - (mm * 60);<BR> <BR> if(start < 60)<BR> time = ss + " seconds ";</FONT></P>
<P><FONT color=blue> else if(start < 3600 && start > 60)<BR> time = mm + " minutes " + ss + " seconds ";<BR> <BR> else<BR> {<BR> time = (hh == 1)? hh + " hour " : hh + " hours ";<BR> time += (mm == 1)? mm + " minute " : mm + " minutes "; <BR> }<BR> writeTime(time);<BR> start++;<BR>}</FONT></P>
<P><FONT color=blue>function scroller()<BR>{<BR> var docH, docW, scrollT, scrollL;<BR> <BR> if(IE)<BR> {<BR> layer = document.all.pane;</FONT></P>
<P><FONT color=blue> if(layerH)<BR> {<BR> layer.height = layerH;<BR> layer.style.height = layerH;<BR> } <BR> else <BR> layerH = layer.height;</FONT></P>
<P><FONT color=blue> if(layerW)<BR> {<BR> layer.width = layerW;<BR> layer.style.width = layerW;<BR> }<BR> else <BR> layerW = layer.width;<BR> <BR> if(bgcolor)<BR> layer.style.background = bgcolor;</FONT></P>
<P><FONT color=blue> <BR> docH = document.body.clientHeight;<BR> docW = document.body.clientWidth;<BR> <BR> scrollT = document.body.scrollTop;<BR> scrollL = document.body.scrollLeft;</FONT></P>
<P><FONT color=blue> switch(location) <BR> {<BR> case "top_left": layer.style.posTop = scrollT;<BR> layer.style.posLeft = scrollL;<BR> break; </FONT></P>
<P><FONT color=blue> case "top_right": layer.style.posTop = scrollT;<BR> layer.style.posLeft = scrollL + (docW - layerW);<BR> break;</FONT></P>
<P><FONT color=blue> case "bottom_left": layer.style.posTop = scrollT + (docH - layerH);<BR> layer.style.posLeft = scrollL;<BR> break;</FONT></P>
<P><FONT color=blue> case "bottom_right": layer.style.posTop = scrollT + (docH - layerH);<BR> layer.style.posLeft = scrollL + (docW - layerW);<BR> break;<BR> <BR> default: layer.style.posTop = scrollT;<BR> layer.style.posLeft = scrollL;<BR> }<BR> layer.style.visibility = "visible"; <BR> }<BR> else<BR> {</FONT></P>
<P><FONT color=blue> layer = document.layers.pane;<BR> <BR> if(!layerH)<BR> layerH = 200;</FONT></P>
<P><FONT color=blue> if(!layerW)<BR> layerW = 100;</FONT></P>
<P><FONT color=blue> <BR> layer.resizeTo(layerW,layerH);<BR> <BR> if(bgcolor && bgcolor != "transparent"<BR> layer.bgColor = bgcolor; <BR> </FONT></P>
<P><FONT color=blue> docH = window.innerHeight;<BR> docW = window.innerWidth;<BR> <BR> scrollT = window.pageYOffset;<BR> scrollL = window.pageXOffset;<BR> <BR> switch(location.toLowerCase()) <BR> {<BR> case "top_left": layer.moveTo(scrollL,scrollT);<BR> break; </FONT></P>
<P><FONT color=blue> case "top_right": layer.moveTo(scrollL + (docW - layerW) - 15, scrollT);<BR> break;</FONT></P>
<P><FONT color=blue> case "bottom_left": layer.moveTo(scrollL, scrollT + (docH - layerH) - 15);<BR> break;</FONT></P>
<P><FONT color=blue> case "bottom_right": layer.moveTo(scrollL + (docW - layerW) - 15,scrollT + (docH - layerH) - 15);<BR> break;<BR> <BR> default: layer.moveTo(scrollL,scrollT);<BR> }<BR> <BR> //make layer visible <BR> layer.visibility = "show";<BR> } <BR>}<BR>//--><BR></script></FONT></P>
<P><FONT color=blue><span id="pane"><layer name="pane" width=&{layerW}; height=&{layerH};></layer></span></FONT></P>
<P><FONT color=blue><script><BR><!--<BR>setInterval("scroller();",10);<BR>if(TimerOrClock.toLowerCase() == "clock"<BR>setInterval("clock();",1000);<BR>else<BR>setInterval("timer();",1000);<BR>//--><BR></script></FONT></P>
<P><FONT color=#000000></FONT> </P>
<P><BR></P>