JohnCC
03-04-2011, 05:14 AM
1) Script Title: Form field Progress Bar
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/limitinput2.htm
3) Describe problem: How to customize the starting and ending colors for the progress bar?
Hello, I need some help to edit the code for this Form Field Progress Bar.
Apparently the JavaScript code is changing CSS values by R-G-B on the fly, as the progress bar goes from zero to 100%. You can see this on Google Chrome (and, presumably, Safari?) but other browsers (IE6, FireFox etc) only show the progress bar as the final, solid color the whole time it's increasing.
But the problem is... on Chrome, in my website layout, the starting color as it is now, does not really work well: It's too faint and does not go with the rest of the page design. The final RED color is OK, but starting out as it is with the faint blue-ish CCFFFF doesn't really work for me :(
What I'd like to be able to do is manually set the starting and ending colors myself, just with simple CSS values, hopefully. This fancy method of setting the color by CSS using Javascript on the fly in this kind of element.style override thing is too complex for my understanding of all of this stuff :p
Any suggestions for code changes anyone here can provide, much obliged...
-JC
P.S. Update: the line in the code that I think controls this seems to be:
function setcolor(obj,percentage,prop){
obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
...where the RGB values are being changed along with the percent variable as it increases. But as far as how to set this so that the actual colors I want to end up with are generated, I can't seem to grok that. I'm not used to doing this as RGB, so... kinda clueless.
P.P.S. Any idea why it's working different in Chrome vs Firefox/IE etc? Just curious...
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/limitinput2.htm
3) Describe problem: How to customize the starting and ending colors for the progress bar?
Hello, I need some help to edit the code for this Form Field Progress Bar.
Apparently the JavaScript code is changing CSS values by R-G-B on the fly, as the progress bar goes from zero to 100%. You can see this on Google Chrome (and, presumably, Safari?) but other browsers (IE6, FireFox etc) only show the progress bar as the final, solid color the whole time it's increasing.
But the problem is... on Chrome, in my website layout, the starting color as it is now, does not really work well: It's too faint and does not go with the rest of the page design. The final RED color is OK, but starting out as it is with the faint blue-ish CCFFFF doesn't really work for me :(
What I'd like to be able to do is manually set the starting and ending colors myself, just with simple CSS values, hopefully. This fancy method of setting the color by CSS using Javascript on the fly in this kind of element.style override thing is too complex for my understanding of all of this stuff :p
Any suggestions for code changes anyone here can provide, much obliged...
-JC
P.S. Update: the line in the code that I think controls this seems to be:
function setcolor(obj,percentage,prop){
obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
...where the RGB values are being changed along with the percent variable as it increases. But as far as how to set this so that the actual colors I want to end up with are generated, I can't seem to grok that. I'm not used to doing this as RGB, so... kinda clueless.
P.P.S. Any idea why it's working different in Chrome vs Firefox/IE etc? Just curious...