close

語法展示::  http://home.graffiti.net/likuuuy688/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<script language="JavaScript">
<!--
var TimerOrClock = "clock";
var layerH = 55;
var layerW = 90;
var location = "top_right";
var bgcolor = "#00FF00";
var text = "#FF0000";
var font_size = 2;
var font_face = "#FF00FF";
var message = "現在時間為:<br>";
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 += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + 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> &nbsp;" + "<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);
 }
    layer.visibility = "show";
  } 
}
-->
</script>
<span id="pane"><layer name="pane" width=&{layerW}; height=&{layerH};></layer></span>
<script language="JavaScript">
<!--
setInterval("scroller();",100); 
if(TimerOrClock.toLowerCase() == "clock")
  setInterval("clock();",1000);
else
  setInterval("timer();",1000);
-->
</script>


var layerH = 55; 中修改時間的高度
var layerW = 90; 中修改時間的寬度
var location = "top_right"; 中修改時間的位置
top_left為左上,top_right為右上,bottom_left為左下,
bottom_right為右下
var bgcolor = "#00FF00"; 中修改底色的顏色
var text = "#FF0000"; 中修改文字的顏色
var font_size = 2; 中修改文字的大小




將以下程式碼複製,貼在<head>及</head>標籤之間。

<style type="text/css">
<!--
#pane {position: absolute; visibility: hidden;}
-->
</style>

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 小小研究生 的頭像
    小小研究生

    小小研究生的部落格

    小小研究生 發表在 痞客邦 留言(0) 人氣()