AGAMES 討論區

標題: 文字(字体)跟著鼠標走 [打印本頁]

作者: dlalden    時間: 2008-11-8 18:26:04     標題: 文字(字体)跟著鼠標走

  1. <style type="text/css">
  2. .spanstyle {
  3. COLOR: #00cccc; FONT-FAMILY: 宋体; FONT-SIZE: 10pt; POSITION: absolute; TOP: -50px; VISIBILITY: visible
  4. }
  5. </style>
  6. <script>
  7. var x,y
  8. var step=18
  9. var flag=0
  10. var message="歡迎您"
  11. message=message.split("")
  12. var xpos=new Array()
  13. for (i=0;i<=message.length-1;i++) {
  14. xpos=-50
  15. }
  16. var ypos=new Array()
  17. for (i=0;i<=message.length-1;i++) {
  18. ypos=-200
  19. }
  20. function handlerMM(e){
  21. x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
  22. y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
  23. flag=1
  24. }
  25. function www1_xise_cn() {
  26. if (flag==1 && document.all) {
  27. for (i=message.length-1; i>=1; i--) {
  28. xpos=xpos[i-1]+step
  29. ypos=ypos[i-1]
  30. }
  31. xpos[0]=x+step
  32. ypos[0]=y
  33. for (i=0; i<message.length-1; i++) {
  34. var thisspan = eval("span"+(i)+".style")
  35. thisspan.posLeft=xpos
  36. thisspan.posTop=ypos
  37. }
  38. }
  39. else if (flag==1 && document.layers) {
  40. for (i=message.length-1; i>=1; i--) {
  41. xpos=xpos[i-1]+step
  42. ypos=ypos[i-1]
  43. }
  44. xpos[0]=x+step
  45. ypos[0]=y
  46. for (i=0; i<message.length-1; i++) {
  47. var thisspan = eval("document.span"+i)
  48. thisspan.left=xpos
  49. thisspan.top=ypos
  50. }
  51. }
  52. var timer=setTimeout("www1_xise_cn()",30)
  53. }
  54. for (i=0;i<=message.length-1;i++) {
  55. document.write("<span id='span"+i+"' class='spanstyle'>")
  56. document.write(message)
  57. document.write("</span>")
  58. }
  59. if (document.layers){
  60. document.captureEvents(Event.MOUSEMOVE);
  61. }
  62. document.onmousemove = handlerMM;
  63. www1_xise_cn();
  64. // -->
  65. </script>
  66.    
複製代碼





歡迎光臨 AGAMES 討論區 (http://forum.agames.hk/) Powered by Discuz! X2