MichaelVB
asked on
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('re d'); // THIS DOES NOT WORK?
var _progressEnd = 10;
var _progressAt = 0;
var _progressWidth = 150; // Display width of progress bar
Thanks for the help.
Mike
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('re
var _progressEnd = 10;
var _progressAt = 0;
var _progressWidth = 150; // Display width of progress bar
Thanks for the help.
Mike
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 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('o bj').style .color = _progressBarColor
or
document.getElementByIName ('obj').st yle.color = '_progressBarColor
for a table cell replace 'color' with 'background'
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('o
or
document.getElementByIName
for a table cell replace 'color' with 'background'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
this is where I found the code
http://javascript.internet.com/messages/progress-dialog.html
thanks,
Mike
http://javascript.internet.com/messages/progress-dialog.html
thanks,
Mike
hey MichaelVB ,
maybe do you want prototype?
here is example:
========================== =========
<script>
function runit()
{
var progressBar = new String("Any help? This is the code");
String.prototype.color = "red";
String.prototype.colored = textColor;
progressBar = progressBar.colored();
document.write(progressBar )
}
function textColor()
{
return "<FONT color='" + this.color + "'>" + this + "</FONT>";
}
</script>
<button onclick=runit()>runit</but ton>
maybe do you want prototype?
here is example:
==========================
<script>
function runit()
{
var progressBar = new String("Any help? This is the code");
String.prototype.color = "red";
String.prototype.colored = textColor;
progressBar = progressBar.colored();
document.write(progressBar
}
function textColor()
{
return "<FONT color='" + this.color + "'>" + this + "</FONT>";
}
</script>
<button onclick=runit()>runit</but
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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 :)
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 :)
document.write('<div id="bar">' + _progressBar + '</div>')
document.getElementById('b
Vinny