Snap Builder Public Codes Library
Snap | Generators | Login | Browse | Search | Enter Code | Export Snap Builder Public Codes Library

 

Category: Javascript Codes Library >> News Ticker & Marquees >> Alternating Message Text Box


Code Snippet </> Info


Snippet Name: Alternating Message Text Box

Description: Place a text box on your Web page that displays alternating messages for your visitors.

Compatible Browsers:
Chrome BrowserFirefox BrowserInternet Explorer BrowserOpera BrowserSafari Browser


Example: View Code Demo


Note:

Author: Sandeep Gangadharan

Last Modified: 2014-05-15 20:18:04

Language: javascript

Highlight Mode: javascript

Copy Codes: Use Free Notepad ++
Bookmark and Share

Snap HTML Code Editor:
Paste the source code, make changes and instantly see it in live preview.
Snap HTML Code Editor


  About Copying
Copied To Clipboard!

<html> <head> <title>Alternating Message Text Box Javascript Code Snippet</title> <style> BODY {font-family:verdana,arial,ms sans serif; font-size:90%;} textarea.test {width:350px; height:20px; border:#e6e6e6 solid 1px;} </style> <script> /* // Begin Alternating Message Text Box // == This Script Free To Use Providing This Notice Remains == // == This Script Has Been Found In The http://www.SnapBuilder.com Free Public Codes Library == // == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == // == Created by: Sandeep Gangadharan | http://sivamdesign.com/scripts// : Creative Commons License == */ var text = 0; var message=new Array(); message[0] = "Welcome to SnapBuilder.com!" message[1] = "Tons of scripts for your Web pages" message[2] = "Why not share your scripts with others?" message[3] = "Be sure to come back again..." function changeText() { if (message.length > 0) { document.change.descript.value=message[text]; text++; } if (text == 4) {text = 0; } // change the # 4 at the left to the maximum # of message lines you want included window.setTimeout("changeText()", 3500); } // change the # on the left to adjust the speed of the // scroll. The smaller the number the faster the speed // Multiple onload function created by: Simon Willison // http://simon.incutio.com/archive/2004/05/26/addLoadEvent function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(function() { changeText(); }); </script> </head> <body style="background-color:#ffffff;"> <form name="change"> <textarea class="test" name="descript" wrap="virtual"></textarea> </form> <br /><br /> <p>Create as many message[#] as you need... just number them in numerically.</p> <p>Change ==&gt; if (text == 4) {text = 0; } // change the # 4 at the left to the maximum # of message lines you want included.</p> <p>Adjust the STYLES to suit your needs.</p> <p>You can transfer the 'javascript' code to an external file to minify your page size.</p> </body> </html>


[ Snippet Options ]

 

© 2002 -  Snap Builder Public Codes Library