javascrib อักษรวิ่งตามเมาท์


ไปไหนไปด้วยกัน อักษรวิ่งตามเมาท์

อักษรวิ่งตามเมาท์ ไปไหนไปด้วยกัน

<!-- ขั้นแรก ให้Coppy ข้อความข้างล่างนี้ไปไว้ระหว่างส่วนของแท็ก <head>...</head>   -->
<head>
<style>
.spanstyle {
        position:absolute;
        visibility:visible;
        top:-50px;
        font-size:10pt;
        font-family:Verdana;
        font-weight:bold;
        color:red;// ตรงนี้เปลี่ยนเป็นสีอื่นได้นะครับ

}
</style>
<script>
var x,y
var step=9
var flag=0
var message="  Produce  By  http://siam.to/eak  "  <!-- ตรงนี้สามารถเปลี่ยนข้อความได้ครับ -->
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) {
        xpos[i]=-50
}
var ypos=new Array()
for (i=0;i<=message.length-1;i++) {
        ypos[i]=-50
}
function handlerMM(e){
        x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
        y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
        flag=1
}
function makesnake() {
        if (flag==1 && document.all) {
        for (i=message.length-1; i>=1; i--) {
                        xpos[i]=xpos[i-1]+step
                        ypos[i]=ypos[i-1]
        }
                xpos[0]=x+step
                ypos[0]=y
                for (i=0; i<message.length-1; i++) {
                var thisspan = eval("span"+(i)+".style")
                thisspan.posLeft=xpos[i]
                thisspan.posTop=ypos[i]
        }
        }
        else if (flag==1 && document.layers) {
        for (i=message.length-1; i>=1; i--) {
                        xpos[i]=xpos[i-1]+step
                        ypos[i]=ypos[i-1]
        }
                xpos[0]=x+step
                ypos[0]=y
                for (i=0; i<message.length-1; i++) {
                var thisspan = eval("document.span"+i)
                thisspan.left=xpos[i]
                thisspan.top=ypos[i]
        }
        }
                var timer=setTimeout("makesnake()",30)
}
</script>


<script language="JavaScript">
<!--
if (document.images) {
   lmenu1on = new Image(149,53); lmenu1on.src="images/lmenu1on.gif";
   lmenu1off = new Image(149,54); lmenu1off.src="images/lmenu1off.gif";

   lmenu2on = new Image(149,47); lmenu2on.src="images/lmenu2on.gif";
   lmenu2off = new Image(149,47); lmenu2off.src="images/lmenu2off.gif";
  
   lmenu3on = new Image(149,45); lmenu3on.src="images/lmenu3on.gif";
   lmenu3off = new Image(149,44); lmenu3off.src="images/lmenu3off.gif";
 
   lmenu4on = new Image(149,43); lmenu4on.src="images/lmenu4on.gif";
   lmenu4off = new Image(149,44); lmenu4off.src="images/lmenu4off.gif";
  
   lmenu5on = new Image(149,46); lmenu5on.src="images/lmenu5on.gif";
   lmenu5off = new Image(149,45); lmenu5off.src="images/lmenu5off.gif";

   lmenu6on = new Image(149,49); lmenu6on.src="images/lmenu6on.gif";
   lmenu6off = new Image(149,48); lmenu6off.src="images/lmenu6off.gif";

}
function turnOn(imageName) {
   if (document.images) {
    document[imageName].src=eval(imageName + "on.src");
  }
}
function turnOff(imageName) {
   if (document.images) {
    document[imageName].src=eval(imageName + "off.src");
  }
}
//End Script
//-->
</script>
<style type="text/css">
</style>
</head>


<!--ขั้นที่สอง ให้Coppy ข้อความข้างล่างนี้ไปไว้ในส่วนของแท็ก <body>   -->
<body onLoad="makesnake()" style="OVERFLOW-X: hidden; OVERFLOW-Y: scroll;>


<!--ขั้นที่สาม ให้Coppy ข้อความข้างล่างนี้ไปไว้ระหว่างส่วนของแท็ก <body>...</body>   -->
<body>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN">
<script>
<!-- Beginning of JavaScript -
for (i=0;i<=message.length-1;i++) {
    document.write("<span id='span"+i+"' class='spanstyle'>")
    document.write(message[i])
    document.write("</span>")
}
if (document.layers){
        document.captureEvents(Event.MOUSEMOVE);
}
   document.onmousemove = handlerMM;
// - End of JavaScript - -->
</script>
</body>

คำสำคัญ (Tags): #uncategorized
หมายเลขบันทึก: 9515เขียนเมื่อ 13 ธันวาคม 2005 11:35 น. ()แก้ไขเมื่อ 11 กุมภาพันธ์ 2012 14:13 น. ()สัญญาอนุญาต: จำนวนที่อ่านจำนวนที่อ่าน:


ความเห็น (0)

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

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