»
Tiếng AnhTiếng PhápTiếng Việt

In - Đổi chữ - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Chữ » Hoạt hóa » Đổi chữ
URL: https://www.javascriptbank.com/text-changer-script.html

Đổi chữ © JavaScriptBank.comHiệu ứng sẽ liên tục đổi chữ trong thẻ DIV chỉ định sau khoảng thời gian xác định.

Phiên bản đầy đủ: jsB@nk » Chữ » Hoạt hóa » Đổi chữ
URL: https://www.javascriptbank.com/text-changer-script.html



JavaScript
<SCRIPT language=javascript><!--/*\/¯\/¯\/¯\/¯\/¯\/¯\/¯\/¯\/¯\/¯\/¯\/¯\/¯\\                                        //  =-=-=-=-=-= Text Changer =-=-=-=-=-=  \\                                        //                                        \\  Author:                               //     Nick Trevino                       \\                                        //                                        \\  Description:                          //     This code changes the text within  \\     the <div> tag below. You can show  //     any number of lines, and it still  \\     will show them all! It also stops  //     changing the text if the user has  \\     their mouse over the text. If you  //     don't want mouse overs to stop it  \\     from changing, then set stopOK to  //     0 instead of 1.                    \\                                        //  Usage Tips:                           \\     You can use this and the HTML tag  //     <img> to make it change different  \\     images on a set timer! Or you can  //     also use it to change links using  \\     the stopping feature so users can  //     click the links! See if there are  \\     other ways you can use it.         //                                        \ \_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\*/// Just put the different bits of text into the array separated by a comma.// You can use HTML tags also. If you need to use quotes, use the single quote,// ( ' ) or use the escape character ( \" ), both without parenthesis.textLines=new Array("<b>Text Changer</b>","Created By...","<b>Nick Trevino</b>","Visit my JavaScript site at:","<a href='http://www.nicksscripts.be'>Nick's Scripts.be</a>","This script is on...","<a href='http://www.JavaScriptBank.com'>JavaScriptBank.com!</a>");// The Text Line to start on (The first line is line 0).numOn=0;// Set the delay time inbetween each change (in seconds, decimal values can be used).delay=1.3;// Set this variable to 0 to stop mouse overs from stopping // the text from changing.stopOK=1;change=1;window.onload=start;function start(){  setTimeout("Change()",1);}function Change(){// Check to see if the user has their mouse over the text. if(change==1){// Make sure we are on a valid Line Number and if not, set it to// the starting line.  if(numOn>=textLines.length||numOn<0){numOn=0}// Set the text inside the <div> to the specified line number.  textChanger.innerHTML=textLines[numOn];// Increase the line number by one to get the next string.  numOn++; }// Call this function again to write the string to the <div>.  setTimeout("Change()",delay*1000);}// --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
.. Here are the lines of text this example will change through: <PRE>1: <B>Text Changer</B>2: Created By...3: <B>Nick Trevino</B>4: This script is on...5: <A href="http://www.JavaScriptBank.com/">JavaScriptBank.com!</A>6: Put this <DIV> tag 7: Anywhere on a page!</DIV></PRE>It can do more lines to if you need to. It can do as many as you need! In this example, the stopping feature is set to: ON. Try moving your mouse over the text. <BR>It will stop changing.<BR><BR><DIV id=textChanger onmouseover=if(stopOK==1){change=0} onmouseout=change=1></DIV><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->