Javascript font color

Hello All,

I am using a javascript function I found on the internet to display a progress bar on the screen. My problem is that right now the progress bar "text", the text that moves across the screen to simulate that something is happening is black. I would like to make it another color but can't seem to find the proper syntax for doing this?

Any help? This is the code
var _progressBar = new String("");
_progressBar.fontcolor('red');   // THIS DOES NOT WORK?
var _progressEnd = 10;
var _progressAt = 0;
var _progressWidth = 150;      // Display width of progress bar

Thanks for the help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


document.write('<div id="bar">' + _progressBar + '</div>')
document.getElementById('bar').style.color = 'red';  

Are you sure this is Javascript ?   for one thing variable-names starting with an '_' character should not be used (they are reserved for predefined values)

I am afraid I would need to see the entire script to make sense of this. could you give a link to the place where you found it?
I can not see  your code but I would image you are using a span,div,table or cell  with some id or a name for the bar.  I think you need this you want this

var _progressBarColor='red'  
var _progressEnd = 10;

if  obj is the name or id and where you have something like this for a span or div  

document.getElementById('obj').style.color = _progressBarColor
document.getElementByIName('obj').style.color = '_progressBarColor

 for a table cell replace 'color' with 'background'

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

typos should read

I can not see your code but I would imagine you are using a span, div, table or table cell  with some id or a name for the bar.  I think you need something like this

var _progressBarColor='red'  
var _progressEnd = 10;

If  obj is the name or id  then use  for a span or div  

document.getElementById('obj').style.color = _progressBarColor
document.getElementByIName('obj').style.color = _progressBarColor

for a table or table  cell replace 'color' with 'background'

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MichaelVBAuthor Commented:
this is where I found the code

hey MichaelVB ,

maybe do you want prototype?
here is example:
function runit()

var progressBar = new String("Any help? This is the code");
String.prototype.color = "red";
String.prototype.colored = textColor;
progressBar = progressBar.colored();


function textColor()
   return "<FONT color='" + this.color  + "'>" + this + "</FONT>";
<button onclick=runit()>runit</button>
just change this line:
document.write("<input type=text name=\"bar\" size=\"" + _progressWidth/2 + "\"");

to this:
document.write("<input style=color:red type=text name=\"bar\" size=\"" + _progressWidth/2 + "\"");
Sorry, That script is horribly Old. written for IE4 and Netscape4. It might work in newer versions of IE, but not in newer netscape or any browser using the DOM model.

I would suggest you scrap it and replace it with code based on GwynforWebs code. evt get him to complete it. ( but no variablenames starting with '_' please :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.