Revolution X

Coding Community => Coding Snippets => Topic started by: DzinestaR on September 07, 2009, 10:10:35 pm



Title: [Code] Simple Announcements
Post by: DzinestaR on September 07, 2009, 10:10:35 pm
Forum Url: http://SMFDesigns.smfforfree3.com

Code Demo! (http://dzinetest10.smfforfree3.com)

This adds a scrolling text box to the top of your forum for quick announcements you may want your members to see right away.

Headers:

Code:
<SCRIPT LANGUAGE="JavaScript">

var myMainMessage="  YOUR SIMPLE ANNOUNCMENT TEXT HERE! ";
var speed=150;
var scrollingRegion=50;

var startPosition=0;
function mainTextScroller() {
        var mainMessage=myMainMessage;
        var tempLoc=(scrollingRegion*3/mainMessage.length)+1;
        if (tempLoc<1) {tempLoc=1}
        var counter;
        for(counter=0;counter<=tempLoc;counter++)
           mainMessage+=mainMessage;
document.mainForm.mainTextScroller.value=mainMessage.substring(startPosition,startPosition+scrollingRegion);
        startPosition++;
        if(startPosition>scrollingRegion) startPosition=0;
        setTimeout("mainTextScroller()",speed); }
</script>

</HEAD>

<BODY onLoad="mainTextScroller()">

<form name="mainForm">
<center>
<input type="text" name="mainTextScroller" size="40" value>
</center>
</form>

You can change the speed of the scroll of the text by modifying this:
Code:
var speed=150;

Change my pre-set text here:

Code:
var myMainMessage="  YOUR SIMPLE ANNOUNCMENT TEXT HERE! ";

Enjoy.

-DzinestaR