Back To TOP

Running Title Bar

1. Choose a Page Element.
2. Add Gadgets.
3. Choose HTML / JavaScript.
4. Copy the code below and paste the widget box
Code:
<script type="text/javascript">
var rev = "fwd";
function titlebar(val)
{
    var msg  = "Enter your text here *** your_site_name.com";
    var res = " ";
    var speed = 100;
    var pos = val;

    msg = "   |--- "+msg+" ---|";
    var le = msg.length;
    if(rev == "fwd"){
        if(pos < le){
        pos = pos+1;
        scroll = msg.substr(0,pos);
        document.title = scroll;
        timer = window.setTimeout("titlebar("+pos+")",speed);
        }
        else{
        rev = "bwd";
        timer = window.setTimeout("titlebar("+pos+")",speed);
        }
    }
    else{
        if(pos > 0){
        pos = pos-1;
        var ale = le-pos;
        scrol = msg.substr(ale,le);
        document.title = scrol;
        timer = window.setTimeout("titlebar("+pos+")",speed);
        }
        else{
        rev = "fwd";
        timer = window.setTimeout("titlebar("+pos+")",speed);
        }    
    }
}

titlebar(0);
</script>
Note:
* Replace the red text
* Adjust the speed by changing the numbers in green
5. Save

Related Posts