找回密码
 注册

文字訊息公告

[复制链接]
Persephone 发表于 9-1-2008 22:14:49 | 显示全部楼层 |阅读模式

马上注册成为YANBONG会员吧!
时下最热门的资讯、娱乐、贴图等分享都在这里等你发掘哦!

您需要 登录 才可以下载或查看,没有账号?注册

×
       將下面框內的程式碼複製,貼在<body>及</body>標籤之間。


  1. <div id="scrollerbg" style="position:absolute;top:-1000px"> </div>
  2. <div id="scrollertext" style="position:absolute;top:-1000px"> </div>
复制代码


       將下面框內的程式碼複製,貼在<head>及</head>標籤之間。




  1. <script language="JavaScript1.2">
  2. var message= new Array()

  3. message[0]="訊息標題|這是公告訊息第一行,標題還可連結唷。 |http://mac.go.3322.org/"

  4. message[1]="萬花筒網路社區|這是公告訊息第二行,標題還可連結唷。 |http://mac.go.3322.org/"

  5. message[2]="網頁特效|這是公告訊息第三行,標題還可連結唷。 |http://mac.go.3322.org/"


  6. // height of the scrollerbox (pixels)
  7. var scrollerheight=20

  8. // width of the titlezone (pixels)
  9. var titlezonewidth=80

  10. // width of the copyzone (pixels)
  11. var copyzonewidth=258

  12. // horizonal position: distance to the top border of the window (pixels)
  13. var scrollertop=240

  14. // vertical position: distance to the left border of the window (pixels)
  15. var scrollerleft=220

  16. // borderwidth of the scroller
  17. var scrollerborder=2

  18. // backgroundcolor for the titlezone
  19. var titlezonebg="330066"

  20. // backgroundcolor for the copyzone
  21. var copyzonebg="CC0000"

  22. // backgroundcolor for the scroller
  23. var scrollbg="AAAAAA"

  24. // The target of your links
  25. // possible values are '_blank', '_self', '_top', '_parent' or the name of
  26. // the target window for instance 'main'
  27. var targetlink="_blank"

  28. // font attributes of the title
  29. var font_titleface="Verdana"
  30. var font_titlecolor="FFFFFF"
  31. var font_titlesize=2

  32. // font attributes of the copytext
  33. var font_copyface="Verdana"
  34. var font_copycolor="FFFFFF"
  35. var font_copysize=2

  36. // set 1 for bold title, set 0 for normal title
  37. var titlebold=0

  38. // set 1 for bold copy, set 0 for normal copy
  39. var copybold=0

  40. // set 'right', 'left' or 'center' to align the title
  41. var titlealign="center"

  42. // set 'right', 'left' or 'center' to align the copy
  43. var copyalign="left"

  44. // standstill between the messages (milliseconds)
  45. var standstill=3000

  46. // Do not edit below this line
  47. var pre_titlebold
  48. var after_titlebold
  49. var pre_copybold
  50. var after_copybold

  51. var cliptop=0
  52. var clipbottom=0
  53. var clipleft=0
  54. var clipright=titlezonewidth+copyzonewidth

  55. var i_message=0
  56. var mes_joined
  57. var mes_split
  58. var contenttext
  59. var contentbg=""

  60. var step=1
  61. var pause=20

  62. if (titlebold==1) {
  63.     pre_titlebold="<b>"
  64.     after_titlebold="</b>"
  65. }
  66. else if (titlebold==0) {
  67.     pre_titlebold=""
  68.     after_titlebold=""
  69. }

  70. if (copybold==1) {
  71.     pre_copybold="<b>"
  72.     after_copybold="</b>"
  73. }
  74. else if (copybold==0) {
  75.     pre_copybold=""
  76.     after_copybold=""
  77. }

  78. function initiate() {
  79.         mes_joined=message[i_message]
  80.         mes_split=mes_joined.split("|")
  81.         
  82.         contenttext="<table cellpadding=4 cellspacing=0 border=0>"
  83.         contenttext+="<tr valign='top'>"
  84.         contenttext+="<td align="+titlealign+" width="+titlezonewidth+" height='"+scrollerheight+"' bgcolor='"+titlezonebg+"'>"
  85.         contenttext+="<a href='"+mes_split[2]+"' target='"+targetlink+"'>"
  86.         contenttext+="<font face='"+font_titleface+"' color='"+font_titlecolor+"' size='"+font_titlesize+"'>"
  87.         contenttext+=pre_titlebold
  88.         contenttext+=mes_split[0]
  89.         contenttext+=after_titlebold
  90.         contenttext+="</font></a></td>"
  91.         contenttext+="<td align="+copyalign+" width="+copyzonewidth+" height='"+scrollerheight+"' bgcolor='"+copyzonebg+"'>"
  92.         contenttext+="<font face='"+font_copyface+"' color='"+font_copycolor+"' size='"+font_copysize+"'>"
  93.         contenttext+=pre_copybold
  94.         contenttext+=mes_split[1]
  95.         contenttext+=after_copybold
  96.         contenttext+="</font></td></tr>"
  97.         contenttext+="</table>"
  98.         
  99.         var bg_width=titlezonewidth+copyzonewidth+2*scrollerborder
  100.         var bg_height=scrollerheight+2*scrollerborder
  101.         
  102.         contentbg="<table width="+bg_width+" height='"+bg_height+"' cellpadding=0 cellspacing=0 border='"+scrollerborder+"'><tr><td bgcolor='"+scrollbg+"'> </td></tr></table>"
  103.    
  104.     if (document.all) {
  105.         scrollertext.innerHTML=contenttext
  106.         scrollerbg.innerHTML=contentbg
  107.         document.all.scrollertext.style.posTop=scrollertop+scrollerheight
  108.         document.all.scrollertext.style.posLeft=scrollerleft
  109.         document.all.scrollerbg.style.posTop=scrollertop-scrollerborder
  110.         document.all.scrollerbg.style.posLeft=scrollerleft-scrollerborder
  111.         document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  112.         scrollin()
  113.     }
  114.     if (document.layers) {
  115.         document.scrollertext.document.write(contenttext)
  116.         document.scrollertext.document.close()
  117.         document.scrollerbg.document.write(contentbg)
  118.         document.scrollerbg.document.close()
  119.         document.scrollertext.top=scrollertop+scrollerheight
  120.         document.scrollertext.left=scrollerleft
  121.         document.scrollerbg.top=scrollertop-scrollerborder
  122.         document.scrollerbg.left=scrollerleft-scrollerborder
  123.         document.scrollertext.clip.left=clipleft
  124.         document.scrollertext.clip.right=clipright
  125.         document.scrollertext.clip.top=cliptop
  126.         document.scrollertext.clip.bottom=clipbottom
  127.         scrollin()
  128.     }
  129. }

  130. function scrollin(){
  131.     if (document.all){
  132.         if (document.all.scrollertext.style.posTop>scrollertop) {
  133.             clipbottom+=step
  134.             document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  135.             document.all.scrollertext.style.posTop-=step
  136.             var timer=setTimeout("scrollin()",pause)
  137.         }
  138.         else {
  139.             clearTimeout(timer)
  140.             var timer=setTimeout("scrollout()",standstill)
  141.         }
  142.     }
  143.     if (document.layers){
  144.         if (document.scrollertext.top>scrollertop) {
  145.             clipbottom+=step
  146.             document.scrollertext.clip.left=clipleft
  147.             document.scrollertext.clip.right=clipright
  148.             document.scrollertext.clip.top=cliptop
  149.             document.scrollertext.clip.bottom=clipbottom
  150.             document.scrollertext.top-=step
  151.             var timer=setTimeout("scrollin()",pause)
  152.         }
  153.         else {
  154.             clearTimeout(timer)
  155.             var timer=setTimeout("scrollout()",standstill)
  156.         }
  157.     }
  158. }

  159. function scrollout(){
  160.     if (document.all){
  161.         if (document.all.scrollertext.style.posTop>(scrollertop-scrollerheight)) {
  162.             cliptop+=step
  163.             document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  164.             document.all.scrollertext.style.posTop-=step
  165.             var timer=setTimeout("scrollout()",pause)
  166.         }
  167.         else {
  168.             clearTimeout(timer)
  169.             changemessage()
  170.         }
  171.     }
  172.     if (document.layers){
  173.         if (document.scrollertext.top>(scrollertop-scrollerheight)) {
  174.             cliptop+=step
  175.             document.scrollertext.clip.left=clipleft
  176.             document.scrollertext.clip.right=clipright
  177.             document.scrollertext.clip.top=cliptop
  178.             document.scrollertext.clip.bottom=clipbottom
  179.             document.scrollertext.top-=step
  180.             var timer=setTimeout("scrollout()",pause)
  181.         }
  182.         else {
  183.             clearTimeout(timer)

  184.             changemessage()
  185.         }
  186.     }
  187. }

  188. function changemessage(){
  189.         i_message++
  190.         if (i_message>message.length-1) {i_message=0}
  191.         mes_joined=message[i_message]
  192.         mes_split=mes_joined.split("|")
  193.         cliptop=0
  194.         clipbottom=0
  195.         
  196.         contenttext="<table cellpadding=4 cellspacing=0 border=0>"
  197.         contenttext+="<tr valign='top'>"
  198.         contenttext+="<td align="+titlealign+" width="+titlezonewidth+" height='"+scrollerheight+"' bgcolor='"+titlezonebg+"'>"
  199.         contenttext+="<a href='"+mes_split[2]+"' target='"+targetlink+"'>"
  200.         contenttext+="<font face='"+font_titleface+"' color='"+font_titlecolor+"' size='"+font_titlesize+"'>"
  201.         contenttext+=pre_titlebold
  202.         contenttext+=mes_split[0]
  203.         contenttext+=after_titlebold
  204.         contenttext+="</font></a></td>"
  205.         contenttext+="<td align="+copyalign+" width="+copyzonewidth+" height='"+scrollerheight+"' bgcolor='"+copyzonebg+"'>"
  206.         contenttext+="<font face='"+font_copyface+"' color='"+font_copycolor+"' size='"+font_copysize+"'>"
  207.         contenttext+=pre_copybold
  208.         contenttext+=mes_split[1]
  209.         contenttext+=after_copybold
  210.         contenttext+="</font></td></tr>"
  211.         contenttext+="</table>"
  212.    
  213.     if (document.all) {
  214.         scrollertext.innerHTML=contenttext
  215.         document.all.scrollertext.style.posTop=scrollertop+scrollerheight
  216.         document.all.scrollertext.style.posLeft=scrollerleft
  217.         document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  218.         scrollin()
  219.     }
  220.     if (document.layers) {
  221.         document.scrollertext.document.write(contenttext)
  222.         document.scrollertext.document.close()
  223.         document.scrollertext.top=scrollertop+scrollerheight
  224.         document.scrollertext.left=scrollerleft
  225.         document.scrollertext.clip.left=clipleft
  226.         document.scrollertext.clip.right=clipright
  227.         document.scrollertext.clip.top=cliptop
  228.         document.scrollertext.clip.bottom=clipbottom
  229.         scrollin()
  230.     }
  231. }

  232. </script>
复制代码

       將下面框內的程式碼複製,插入<body>標籤裡面。


  1. onLoad="initiate()"
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

ADVERTISEMENT

Archiver|手机版|小黑屋|YANBONG

GMT+8, 25-4-2024 15:57

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

重要声明:本网站是以即时上载留言的方式运作,本站对所有留言的真实性、完整性及立场等,不负任何法律责任。而一切留言之言论只代表留言者个人意见,并非本网站之立场,用户不应信赖内容,并应自行判断内容之真实性。由于讨论区是受到「即时留言」运作方式所规限,故不能完全监察所有即时留言,若读者发现有留言出现问题,请联络我们。本站有权删除任何留言及拒绝任何人士留言,同时亦有不删除留言的权利。切勿撰写粗言秽语、诽谤、渲染色情暴力或人身攻击的言论,敬请自律。
Proudly hosted by
LinodeDigital Ocean
快速回复 返回顶部 返回列表