笨笨網站超級論壇 (綠色版本)


頁: [1]

#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>&lt;style type="text/css"&gt;<BR>#pane {position: absolute; visibility: hidden;}<BR>&lt;/style&gt;<BR>&lt;style fprolloverstyle&gt;A:hover {color: red; font-weight: bold}<BR>&lt;/style&gt;</FONT></P>
<P><FONT color=blue>&lt;script language="JavaScript"&gt;<BR>&lt;!--<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 = "&lt;font face = \"" + face + "\" size = " + size + " color = \"" + color + "\"&gt;";<BR> out += (message)? message : "";</FONT></P>
<P><FONT color=blue> if(!IE)<BR>      out += "      " + time + "&lt;/font&gt;";<BR> else<BR>      out +=  time + "&lt;/font&gt;";<BR>  <BR> if(IE)<BR>   layer.innerHTML = "&lt;table width=\"100%\" height=\"100%\"&gt;&lt;tr&gt;&lt;td valign=\"middle\" align=\"center\"&gt;" + out + "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";<BR>    else<BR>    {  <BR>   layer.document.open();<BR>   layer.document.write("&lt;br&gt;  " + "&lt;b&gt;" + out + "&lt;/b&gt;";<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 &gt; 12)<BR>  {<BR>     hh -= 12;<BR>  ampm = "pm";<BR>  } <BR>  <BR>  hh = (hh &lt; 10)? "0" + hh : hh;<BR>  mm = (mm &lt; 10)? "0" + mm : mm;<BR>  ss = (ss &lt; 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 &lt; 60)<BR>     time = ss + " seconds ";</FONT></P>
<P><FONT color=blue>   else if(start &lt; 3600 && start &gt; 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>//--&gt;<BR>&lt;/script&gt;</FONT></P>
<P><FONT color=blue>&lt;span id="pane"&gt;&lt;layer name="pane" width=&{layerW}; height=&{layerH};&gt;&lt;/layer&gt;&lt;/span&gt;</FONT></P>
<P><FONT color=blue>&lt;script&gt;<BR>&lt;!--<BR>setInterval("scroller();",10);<BR>if(TimerOrClock.toLowerCase() == "clock"<BR>setInterval("clock();",1000);<BR>else<BR>setInterval("timer();",1000);<BR>//--&gt;<BR>&lt;/script&gt;</FONT></P>
<P><FONT color=#000000></FONT> </P>
<P><BR></P>

#2  複製上列語法 -  (Administrator) 發表於 25-5-2013 16:12

<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<style type="text/css">
#pane {position: absolute; visibility: hidden;}
</style>
<style fprolloverstyle>A:hover {color: red; font-weight: bold}
</style>

<script language="JavaScript">
<!--
var TimerOrClock = "clock";

//layer height
var layerH = 30;  //時鐘顯示的高度

//layer width
var layerW = 180;  //時鐘顯示的寬度

//location of the layer on the page:
//top_left, top_right, "bottom_left", "bottom_right"
var location = "top_right";

//background color of the layer:
//transparent - inherits the background of the page;
//any color as a word or in hexadecimal
var bgcolor = "#000000";  //顯示背景顏色

//font color
var text = "#FF0000";  //顯示文字顏色

//font size
var font_size = 3;

//font face
var font_face = "新明細體";

//your words
var message = "現在時間:";

/***************** DO NOT EDIT BELOW THIS LINE ***************/
var layer;
var IE = document.all;
var updateWatch;
var start = 0;

function writeTime(time)
{
    var color, size, face, out;

color = (text)? text : "black";
size = (font_size)? font_size : 2;
face = (font_face)? font_face : "Arial";
   
out = "<font face = \"" + face + "\" size = " + size + " color = \"" + color + "\">";
out += (message)? message : "";

if(!IE)
      out += "      " + time + "</font>";
else
      out +=  time + "</font>";
  
if(IE)
   layer.innerHTML = "<table width=\"100%\" height=\"100%\"><tr><td valign=\"middle\" align=\"center\">" + out + "</td></tr></table>";
    else
    {  
   layer.document.open();
   layer.document.write("<br>  " + "<b>" + out + "</b>";
   layer.document.close();
}
}

function clock()
{
  var hh, mm, ss;
  var time, d, ampm = "am";

  d = new Date();
  
  hh = d.getHours();
  mm = d.getMinutes();
  ss = d.getSeconds();
  
  if(hh > 12)
  {
     hh -= 12;
  ampm = "pm";
  }
  
  hh = (hh < 10)? "0" + hh : hh;
  mm = (mm < 10)? "0" + mm : mm;
  ss = (ss < 10)? "0" + ss : ss;

  time = hh + ":" + mm + ":" + ss + "  " + ampm;
  
  writeTime(time);
}

function timer()
{
   var hh, mm, ss;
   var time;
   
   hh = parseInt("0" + (start / 3600), 10);
   mm = parseInt("0" + ((start - (hh * 3600)) / 60), 10);
   ss = start - (hh * 3600) - (mm * 60);
   
   if(start < 60)
     time = ss + " seconds ";

   else if(start < 3600 && start > 60)
     time = mm + " minutes " + ss + " seconds ";
   
   else
   {
     time = (hh == 1)? hh + " hour " : hh + " hours ";
  time += (mm == 1)? mm + " minute " : mm + " minutes ";  
   }
   writeTime(time);
   start++;
}

function scroller()
{
  var docH, docW, scrollT, scrollL;
      
  if(IE)
  {
    layer =  document.all.pane;

if(layerH)
{
   layer.height = layerH;
      layer.style.height = layerH;
}  
else  
   layerH = layer.height;

if(layerW)
{
   layer.width = layerW;
   layer.style.width = layerW;
}
else  
   layerW = layer.width;

if(bgcolor)
   layer.style.background = bgcolor;


docH = document.body.clientHeight;
docW = document.body.clientWidth;

scrollT = document.body.scrollTop;
scrollL = document.body.scrollLeft;

    switch(location)
{
    case "top_left":  layer.style.posTop =  scrollT;
                         layer.style.posLeft = scrollL;
       break;

    case "top_right":    layer.style.posTop =  scrollT;
                         layer.style.posLeft = scrollL + (docW - layerW);
                            break;

       case "bottom_left":  layer.style.posTop =  scrollT + (docH - layerH);
                         layer.style.posLeft = scrollL;
                            break;

       case "bottom_right": layer.style.posTop =  scrollT + (docH - layerH);
                         layer.style.posLeft = scrollL + (docW - layerW);
                            break;
   
    default:             layer.style.posTop =  scrollT;
                         layer.style.posLeft = scrollL;
}
    layer.style.visibility = "visible";  
  }
  else
  {

    layer = document.layers.pane;

    if(!layerH)
   layerH = 200;

if(!layerW)
   layerW = 100;

   
layer.resizeTo(layerW,layerH);
   
    if(bgcolor && bgcolor != "transparent"
   layer.bgColor = bgcolor;


docH = window.innerHeight;
docW = window.innerWidth;

scrollT = window.pageYOffset;
scrollL = window.pageXOffset;

switch(location.toLowerCase())
{
    case "top_left":  layer.moveTo(scrollL,scrollT);
       break;

    case "top_right":    layer.moveTo(scrollL + (docW - layerW) - 15, scrollT);
                         break;

       case "bottom_left":  layer.moveTo(scrollL, scrollT + (docH - layerH) - 15);
                            break;

       case "bottom_right": layer.moveTo(scrollL + (docW - layerW) - 15,scrollT + (docH - layerH) - 15);
                         break;
   
    default:             layer.moveTo(scrollL,scrollT);
}

//make layer visible   
    layer.visibility = "show";
  }
}
//-->
</script>

<span id="pane"><layer name="pane" width=&{layerW}; height=&{layerH};></layer></span>

<script>
<!--
setInterval("scroller();",10);
if(TimerOrClock.toLowerCase() == "clock"
setInterval("clock();",1000);
else
setInterval("timer();",1000);
//-->
</script>
</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>

<br>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
頁: [1]

Powered by Discuz Simply! 0.54 Released © wxyuan90