大頭恩之prototype.js學習手記(04)

Html,Js,Ajax相關, Prototype教學, 程式設計 四月 23rd, 2008

連發3篇..進度應該有趕上吧!

這篇介紹的是$A()
A..作者應該是用來表示陣列的意思吧
所以它可以用來取像select box這樣有多個值的物件
請看範例說明
Read the rest of this entry »

大頭恩Prototype.js學習手記(03)

Html,Js,Ajax相關, Prototype教學 四月 23rd, 2008

第3篇手記要介紹的是$F()

對了..在用這些功能時,請記住…大小寫是有區分的哦!
Read the rest of this entry »

大頭恩之Prototype.js 學習手記(02)

Html,Js,Ajax相關, Prototype教學 四月 23rd, 2008

最近心情一直都不好…晚上都失眠…偷懶了好幾天…才再補上第2篇筆記….><
好了..第二個功能是$$()
Read the rest of this entry »

使用setTimeout() 加 innerHtml屬性制作時鐘

Html,Js,Ajax相關 九月 21st, 2007

<script language=”JavaScript”>
<!–
var now,hours,minutes,seconds,timeValue;
function showtime(){
now = new Date();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
timeValue = (hours >= 12) ? “下午 ” : “上午 “;
timeValue += ((hours > 12) ? hours - 12 : hours) + ” 點”;
timeValue += ((minutes < 10) ? ” 0″ : ” “) + minutes + ” 分”;
timeValue += ((seconds < 10) ? ” 0″ : ” “) + seconds + ” 秒”;
clock.innerHTML = timeValue;
setTimeout(”showtime()”,1000);
}
showtime();
//–>
</script>
<body onload=”showtime();” >
<span id=’clock’></span>

  • <span id=’clock’></span>用來顯示時間的文字圖層。
  • var now, hours, minutes, seconds, timeValue,宣告變數
  • now=new Date()
    hours=now.getHours();,取得現在的時間,依次類推
  • clock.innerHTML=timeValue;利用InnerHtml屬性設定clock span tag中的內容
  • setTimeout(”showtime()”,1000),setTimeout就是計時器,每隔1000毫秒會重新執行一次showtime();
  • blank