close

語法展示::   http://home.graffiti.net/kdhdfgee/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<center>
<form>
<textarea name="teletype" rows=3 cols=50 wrap=yes ></textarea>
<br><br>
<table border=0 width=250>
<td align="center"><input type="button" value="上一則" onClick="lastMessage()">
<td align="center"><input type="text" size=3>
<td align="center"><input type="button" value="下一則" onClick="nextMessage()">
</table>
</form>
</center>

<textarea name="teletype" rows=3 cols=50 wrap=yes > 中修改訊息欄的高度及寬度


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

<script language="JavaScript">
<!--
// used to track position in message
   var i = 0;
// used to cycle thru messages                                         
   var TextNumber = -1;
// array of messages                       
   var TextInput = new Object();
// used to load manipulate message         
   var HelpText="";                             
// used to load message
   var Text = ""; 
// length of timeout (smaller is faster)                                 
   var Speed=50;
// used to display message number
   var message=0;
// used to position text in ver 2.0
   var addPadding="\r\n";
// Each element of TextInput represents a single message.
TextInput[0] = "歡迎光臨!!"; 
TextInput[1] = "有空請多來逛逛~要幫我點擊廣告ㄛ!";
TextInput[2] = "你真的有去點擊廣告嗎......";
TotalTextInput = 2; // (0, 1, 2, 3, 4, 5, 6, 7)
// Positioning and speed vary between versions.
var Version =  navigator.appVersion; 
if (Version.substring(0, 1)==3)
   {
   Speed=100;
   addPadding="";
   }
for (var addPause = 0; addPause <= TotalTextInput; addPause++)
   {TextInput[addPause]=addPadding+TextInput[addPause];}
var TimerId
var TimerSet=false;
// Called by >>> button (display next message) .
function nextMessage() 
   {
   if (!TimerSet)
      {
      TimerSet=true;
      clearTimeout (TimerId);
      if (TextNumber>=TotalTextInput)
         {
         alert("訊息結束!");
         TimerSet=false;
         }
      else
         {
         TextNumber+=1;
         message=TextNumber+1;
         document.forms[0].elements[2].value= message;
         Text = TextInput[TextNumber];
         HelpText = Text;
         }
      teletype();
      }
   }
// Gets and displays character from rollMessage() .
// Variable Speed controls length of timeout and thus the speed of typing.
function teletype()
   {
   if (TimerSet)
      {
      Text=rollMessage();
      TimerId = setTimeout("teletype()", Speed);
      document.forms[0].elements[0].value=Text;
      }
   }
// Pulls one character at a time from string and returns (as Text) to function teletype() for displaying.
function rollMessage ()
   {
   i++;
   var CheckSpace = HelpText.substring(i-1, i);
   CheckSpace = "" + CheckSpace;
   if (CheckSpace == " ")
      {i++;}
   if (i >= HelpText.length+1)
      {
      TimerSet=false;
      Text = HelpText.substring(0, i);
      i=0;
      return (Text);
      }
   Text = HelpText.substring(0, i);
   return (Text);
   }
// Initially called by onLoad in BODY tag to load title.
function initTeleType()
   {
   Text="\r\n         訊息欄──按下面按鈕可逐一瀏覽訊息";
   document.forms[0].elements[0].value=Text;
   }
// Called by <<< button (get previous message).
function lastMessage()
   {
   if (!TimerSet && TextNumber!=-1)
      {
      TimerSet=true;
      clearTimeout (TimerId);
      if (TextNumber<=0)
         {
         alert("之前已無訊息!");
         TimerSet=false;
         }
      else
         {
         TextNumber-=1;
         message=TextNumber+1;
         document.forms[0].elements[2].value= message;
         Text = TextInput[TextNumber];
         HelpText = Text;
         }
      teletype(); 
      }
   }
-->
</script>


TextInput[0] = "歡迎光臨!!"; 
TextInput[1] = "有空請多來逛逛~要幫我點擊廣告ㄛ!";
TextInput[2] = "你真的有去點擊廣告嗎......";
中修改要顯示的文字
Text="\r\n        訊息欄──按下面按鈕可逐一瀏覽訊息"; 中修改預設訊息


將以下程式碼複製,貼在<body >標籤裡面。

 onLoad="initTeleType()"

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 就是愛吃我是好人 的頭像
    就是愛吃我是好人

    就是愛吃我是好人

    就是愛吃我是好人 發表在 痞客邦 留言(0) 人氣()