Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-08-2007, 09:11 AM   PM User | #1
truviet911
New Coder

 
Join Date: Sep 2004
Location: California
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
truviet911 is an unknown quantity at this point
scrolling text with color

hey guys is it possible to have scrolling text on status bar with a specify color? for example i have this code on my page the default text is black. but how do i change the text color? me don't know about javascript hehe

<Script LANGUAGE="JavaScript">
var Count = 3;
var Text = " ** Type your personalized message here! And you are set.";
var Speed = 60;
var timerID = null;
var TimerRunning = false;

var i = 0;
while (i ++ < 140)
Text = " " + Text;

function Scroll(){
window.status = Text.substring(Count++, Text.length);
if (Count == Text.length)
Count = 0;
timerID = setTimeout("Scroll()", Speed);
TimerRunning = true;
}

function Start(){
Stop();
Scroll();
}

function Stop(){
if(TimerRunning)
clearTimeout(timerID);
TimerRunning = false;
}

Start();

</Script>
truviet911 is offline   Reply With Quote
Old 07-08-2007, 08:38 PM   PM User | #2
rwedge
Regular Coder

 
Join Date: Feb 2005
Posts: 679
Thanks: 0
Thanked 16 Times in 15 Posts
rwedge is on a distinguished road
Most browsers do not give you access to the status bar and it could be turned off by the user.

Should these lines be in there?
Code:
var i = 0;
while (i ++ < 140)
Text = " " + Text;
Unless you are using ** as a leader, you should reset Count to 3 in the Scroll function.

Instead of using 'Start();' to run the script you should use
window.onload=Start; or <body onload="Start()">
rwedge is offline   Reply With Quote
Old 07-09-2007, 06:17 AM   PM User | #3
truviet911
New Coder

 
Join Date: Sep 2004
Location: California
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
truviet911 is an unknown quantity at this point
Quote:
Originally Posted by rwedge View Post
Most browsers do not give you access to the status bar and it could be turned off by the user.

Should these lines be in there?
Code:
var i = 0;
while (i ++ < 140)
Text = " " + Text;
it still works if you take it out .
Unless you are using ** as a leader, you should reset Count to 3 in the Scroll function.

Instead of using 'Start();' to run the script you should use
window.onload=Start; or <body onload="Start()">
for this one . i don't understand what you trying to say. srry im bad at english.
truviet911 is offline   Reply With Quote
Old 07-09-2007, 07:19 AM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,038
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
The answer to your question is no, you cannot alter the colour of the text in the status bar.

For the rest,

var i = 0;
while (i ++ < 140)
Text = " " + Text;

adds 140 spaces before the start of the message so as to approximately centre it in the screen. You may want to adjust 140 depending on the actual length of your own message.

"Instead of using 'Start();' to run the script you should use
window.onload=Start; or <body onload="Start()">" Both of these are simply alternative ways of calling the script.
Philip M is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:24 PM.


Advertisement
Log in to turn off these ads.