[ JavaScript ] テキストフィールド内の文字をスクロールするサンプル

JavaScript でテキストフィールド内の文字をスクロールするサンプルです。

サンプルコード ———————————————————————-

<html><head>
<title>JavaScript Text Scroll</title>

<script language="JavaScript"> 

    <!--変数に値を入力-->
    var text=&#8221;「Javascript」を使った日本語テキストのスクロール&#8221;; 
    var n=text.length; 

    function message()
    { 
    document.Mymessage.box.value = text; 

    <!--window.status=text;--> 

    text=text.substring(2,n)+text.substring(0,2); 
    setTimeout(&#8220;message()&#8221;,200); 
    }
</script> 

</head><body>

<!--make text field & Form-->
<form name="Mymessage"> 
<input name="box" maxlength="50" size="50"> 

<!--action script-->
<script> message(); </script> 

<!--end Form-->
</form> 

</body> 

実際に動作するサンプル ———————————————————————-

サンプルファイル

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です