TShopping

 找回密碼
 註冊
搜索
查看: 1147|回復: 3

[教學] 訊息公告欄

  [複製鏈接]
發表於 2009-5-23 16:13:47 | 顯示全部樓層 |閱讀模式
 
Push to Facebook Push to Plurk Push to Twitter 

  1. <p align="center"><font color="#000000" size="3"><script>
  2. <!-- Activate Cloaking Device

  3. // used to track position in message
  4. var i = 0;
  5. // used to cycle thru messages
  6. var TextNumber = -1;
  7. // array of messages
  8. var TextInput = new Object();
  9. // used to load manipulate message
  10. var HelpText="";
  11. // used to load message
  12. var Text = "";
  13. // length of timeout (smaller is faster)
  14. var Speed=50;
  15. // used to display message number
  16. var message=0;
  17. // used to position text in ver 2.0
  18. var addPadding="\r\n";

  19. // Each element of TextInput represents a single message.
  20. TextInput[0] = "【Java Script】利用Script程式所撰寫出來的網頁特效 100%。";
  21. TextInput[1] = "【Java下載區】有有一些不錯的特效讓你下載。";
  22. TextInput[2] = "【網站登錄】免費讓你廣告登錄宣傳你的網站。";
  23. TextInput[3] = "【訪客留言】請留下你給閒居小棧的建議及指教。";
  24. TotalTextInput = 4; // (0, 1, 2, 3)

  25. // Positioning and speed vary between versions.
  26. var Version = navigator.appVersion;
  27. if (Version.substring(0, 1)==3)
  28. {
  29. Speed=100;
  30. addPadding="";
  31. }

  32. for (var addPause = 0; addPause <= TotalTextInput; addPause++)
  33. {TextInput[addPause]=addPadding+TextInput[addPause];}

  34. var TimerId
  35. var TimerSet=false;

  36. // Called by >>> button (display next message) .
  37. function nextMessage()
  38. {
  39. if (!TimerSet)
  40. {
  41. TimerSet=true;
  42. clearTimeout (TimerId);
  43. if (TextNumber>=TotalTextInput)
  44. {
  45. alert("說明結束");
  46. TimerSet=false;
  47. }
  48. else
  49. {
  50. TextNumber+=1;
  51. message=TextNumber+1;
  52. document.forms[0].elements[2].value= message;
  53. Text = TextInput[TextNumber];
  54. HelpText = Text;
  55. }
  56. teletype();
  57. }
  58. }

  59. // Gets and displays character from rollMessage() .
  60. // Variable Speed controls length of timeout and thus the speed of typing.
  61. function teletype()
  62. {
  63. if (TimerSet)
  64. {
  65. Text=rollMessage();
  66. TimerId = setTimeout("teletype()", Speed);
  67. document.forms[0].elements[0].value=Text;
  68. }
  69. }

  70. // Pulls one character at a time from string and returns (as Text) to function teletype() for displaying.
  71. function rollMessage ()
  72. {
  73. i++;
  74. var CheckSpace = HelpText.substring(i-1, i);
  75. CheckSpace = "" + CheckSpace;
  76. if (CheckSpace == " ")
  77. {i++;}
  78. if (i >= HelpText.length+1)
  79. {
  80. TimerSet=false;
  81. Text = HelpText.substring(0, i);
  82. i=0;
  83. return (Text);
  84. }
  85. Text = HelpText.substring(0, i);
  86. return (Text);
  87. }

  88. // Initially called by onLoad in BODY tag to load title.
  89. function initTeleType()
  90. {
  91. Text="\r\n ";
  92. document.forms[0].elements[0].value=Text;
  93. }

  94. // Called by <<< button (get previous message).
  95. function lastMessage()
  96. {
  97. if (!TimerSet && TextNumber!=-1)
  98. {
  99. TimerSet=true;
  100. clearTimeout (TimerId);
  101. if (TextNumber<=0)
  102. {
  103. alert("說明結束");
  104. TimerSet=false;
  105. }
  106. else
  107. {
  108. TextNumber-=1;
  109. message=TextNumber+1;
  110. document.forms[0].elements[2].value= message;
  111. Text = TextInput[TextNumber];
  112. HelpText = Text;
  113. }
  114. teletype();
  115. }
  116. }

  117. // Deactivate Cloaking -->
  118. </script></font></p>


  119. <h3 align="center"><font color="#FFFF00" size="4">──訊息公告欄──
  120. </font></h3>

  121. <form>
  122. <center><font size="6"><textarea name="teletype"
  123. rows="3" cols="55" wrap="yes"></textarea> </font>
  124. <div align="center"><center><table border="0" width="250">
  125. <tr>
  126. <td align="center" valign="top"><font size="6"><input
  127. type="button" value="往上一訊息"
  128. onclick="lastMessage()"></font></td>
  129. <td align="center"><font size="6"><input type="text"
  130. size="3"> </font></td>
  131. <td align="center" valign="top"><font size="6"><input
  132. type="button" value="往下一訊息"
  133. onclick="nextMessage()"></font></td>
  134. </tr>
  135. </table>
  136. </center></div>
  137. </form></center>
複製代碼

 

臉書網友討論
發表於 2013-11-14 00:16:43 | 顯示全部樓層
ding   支持  

版主招募中

發表於 2015-7-8 11:13:45 | 顯示全部樓層
大家顶啊,这么好的帖子,楼主辛苦了












超级能源强国


發表於 2016-3-13 08:13:48 | 顯示全部樓層
不服不行,楼主就是有水平


您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2016-12-11 06:44 , Processed in 0.082011 second(s), 18 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表