網頁狀態欄頁面停留時間特效

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>網頁狀態欄頁面停留時間特效</title>
</head>

<body οnlοad=startClock()>

<SCRIPT language=javascript>
var Temp;
var TimerId = null;
var TimerRunning = false;
Seconds = 0
Minutes = 0
Hours = 0
function showtime()
{
if(Seconds >= 59)
{
Seconds = 0
if(Minutes >= 59)
{
Minutes = 0
if(Hours >= 23)
{
Seconds = 0
Minutes = 0
Hours = 0
}
else {
++Hours
}
}
else {
++Minutes
}
}
else {
++Seconds
}
if(Seconds != 1) { var ss="s" } else { var ss="" }
if(Minutes != 1) { var ms="s" } else { var ms="" }
if(Hours != 1) { var hs="s" } else { var hs="" }
Temp = '你在本頁停留了 '+Hours+' 小時'+', '+Minutes+' 分'+', '+Seconds+' 秒'+''
window.status = Temp;
TimerId = setTimeout("showtime()", 1000);
TimerRunning = true;
}
var TimerId = null;
var TimerRunning = false;
function stopClock() {
if(TimerRunning)
clearTimeout(TimerId);
TimerRunning = false;
}
function startClock() {
stopClock();
showtime();
}
function stat(txt) {
window.status = txt;
setTimeout("erase()", 2000);
}
function erase() {
window.status = "";
}
</SCRIPT>

</body>
</html>

 

 

 

 

 

<!----------------------------------------------------------------狀態欄顯示當前時間及日期--------------------------------------------------------->

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
</head>

<META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD>
<body onLoad="run(); timerONE=window.setTimeout">
<SCRIPT language=JavaScript>
<!-- Hide
      timeID = null;
      timeRunning = false;
function stop () {
      if(timeRunning)
            clearTimeout(timeID);
      timeRunning = false;
}
function time () {
      tick = new Date();
      hours = tick.getHours();
      minutes = tick.getMinutes();
      seconds = tick.getSeconds();
      day = tick.getDay();
      month = tick.getMonth();
      date = tick.getDate();
      year = tick.getYear();
      current = "" + ((hours >12) ? hours -12 :hours)
      current += ((minutes < 10) ? ":0" : ":") + minutes
      current += ((seconds < 10) ? ":0" : ":") + seconds
      current += (hours >= 12) ? " P.M." : " A.M."
      if(day==0){var weekday = " 星期日"}
      if(day==1){var weekday = " 星期一"}
      if(day==2){var weekday = " 星期二"}
      if(day==3){var weekday = " 星期三"}
      if(day==4){var weekday = " 星期四"}
      if(day==5){var weekday = " 星期五"}
      if(day==6){var weekday = " 星期六"}
      current +=(weekday)
      window.status=current;
      timeID = setTimeout("time()",1000);
      timeRunning = true;
}
function run(){
      stop();
      time();
}

//-->
</SCRIPT>

</body>
</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章