โค้ดแสดงเวลาว่าคุณอยู่หน้านี้นานเท่าไหร่ที่ไตเติ้ลบาร์
<script language="javascript"> var d_title="คุณเข้าหน้านี้มาเป็นเวลา : " var get_time //get the login time var login_h=new Date() var login_ms=login_h.getTime() function get_current_time(){ var one_sec=1000 current_time=new Date() current_time.getTime() //hold the login time of the user var login_time=Math.floor((current_time-login_ms)/one_sec) document.title=d_title+" "+login_time+" "+"วินาที" //if he pass the minute if (login_time>60){ var m=Math.floor(login_time/60) var s=login_time%60 document.title=d_title+" "+m+" "+"นาที "+s+" "+"วินาที" } } function loop_time() { setInterval("get_current_time()",100) } window.onload =loop_time --> </script>
|
โค้ดบอกวัน-เดือน-ปี-และเวลาเป็นภาษาไทยที่ไตเติ้ลบาร์..แถบสีน้ำเงินด้านบนสุดของหน้าคอม
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function clock() {
var date = new Date()
var year = date.getYear()
var month = date.getMonth()
var day = date.getDate()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
var months = new Array("", "มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม")
var monthname = months[month]
if (hour > 12) {
hour = hour - 12
}
if (minute < 10) {
minute = "0" + minute
}
if (second < 10) {
second = "0" + second
}
document.title = "ขณะนี้ : เดือน " + monthname + " วันที่ " + day + " ปี ค.ศ. " + year + " เวลา " + hour + ":" + minute + ":" + second
setTimeout("clock()", 1000)
}
// End -->
</script>
<body onLoad="clock()" >
</body>
|
โค้ดมีอักษรขึ้นมาทีละตัวที่ไตเติ้ลบาร์ครับ
<script language="JavaScript1.2">
var message="เขียนข้อความที่ต้องการที่นี่" //specifys the title
var message=message+" " //gives a pause at the end,1 space=1 speed unit, here I used 10 spaces@150 each = 1.5seconds.
i="0" //declares the variable and sets it to start at 0
var temptitle="" //declares the variable and sets it to have no value yet.
var speed="150" //the delay in milliseconds between letters
function titler(){
if (!document.all&&!document.getElementById)
return
document.title=temptitle+message.charAt(i) //sets the initial title
temptitle=temptitle+message.charAt(i) //increases the title by one letter
i++ //increments the counter
if(i==message.length) //determines the end of the message
{
i="0" //resets the counter at the end of the message
temptitle="" //resets the title to a blank value
}
setTimeout("titler()",speed) //Restarts. Remove line for no-repeat.
}
window.onload=titler
</script>
|
โค้ดแสดงเวลาว่าคุณอยู่หน้านี้นานเท่าไหร่ที่ไตเติ้ลบาร์
<script language="javascript"> var d_title="คุณเข้าหน้านี้มาเป็นเวลา : " var get_time //get the login time var login_h=new Date() var login_ms=login_h.getTime() function get_current_time(){ var one_sec=1000 current_time=new Date() current_time.getTime() //hold the login time of the user var login_time=Math.floor((current_time-login_ms)/one_sec) document.title=d_title+" "+login_time+" "+"วินาที" //if he pass the minute if (login_time>60){ var m=Math.floor(login_time/60) var s=login_time%60 document.title=d_title+" "+m+" "+"นาที "+s+" "+"วินาที" } } function loop_time() { setInterval("get_current_time()",100) } window.onload =loop_time --> </script>
|
โค้ดข้อความที่เราเขียนวิ่งไปเรื่อยๆทไตเติ้ลบาร์
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin var scrl = "เขียนข้อความที่นี่ "; function scrlsts() { scrl = scrl.substring(1, scrl.length) + scrl.substring(0, 1); document.title = scrl; setTimeout("scrlsts()", 300); } // End --> </script>
</head>
<BODY onLoad="scrlsts()" >
</body>
|
By kungdk007