ทำตัวอักษรเปลี่ยนสีไปเรื่อยๆบนเว็บ


java

นำ CODE ด้านล่างไปไว้ในตำแหน่งที่ต้องการให้แสดงข้อความในแท็ก <body>

-----------------------------------

<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
   }
}

var ctext = "เขียนข้อความที่นี่ครับ";
var speed = 1000;
var x = 0;
var color = new initArray(
"yellow",
"green",
"blue",
"black",
"orange",
"#CC33FF",
"#C0C0C0"
);
if(navigator.appName == "Netscape") {
document.write('<layer id="c"><center>'+ctext+'</center></layer><br>');
}
if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<div id="c"><center>'+ctext+'</center></div>');
}
function chcolor(){
if(navigator.appName == "Netscape") {
document.c.document.write('<center><font color="'+color[x]);
document.c.document.write('">'+ctext+'</font></center>');
document.c.document.close();
}
else if (navigator.appVersion.indexOf("MSIE") != -1){
document.all.c.style.color = color[x];
}
(x < color.length-1) ? x++ : x = 0;
}
setInterval("chcolor()",1000);
// EndA1 -->
</script>

---------------------------------------------------------------------- 

**ข้อมูลจาก  bcoms.net

คำสำคัญ (Tags): #แต่งเว็บ
หมายเลขบันทึก: 114609เขียนเมื่อ 25 กรกฎาคม 2007 23:37 น. ()แก้ไขเมื่อ 11 กุมภาพันธ์ 2012 19:38 น. ()สัญญาอนุญาต: จำนวนที่อ่านจำนวนที่อ่าน:


ความเห็น (0)

ไม่มีความเห็น

พบปัญหาการใช้งานกรุณาแจ้ง LINE ID @gotoknow
ClassStart
ระบบจัดการการเรียนการสอนผ่านอินเทอร์เน็ต
ทั้งเว็บทั้งแอปใช้งานฟรี
ClassStart Books
โครงการหนังสือจากคลาสสตาร์ท