1 (edited by Kuro 2004-02-20 22:44)

Topic: Help with CSS/javascript Color format problem with Mozilla...

Okay, here is my problem :

I added a "color selector" to the my PunBB, but I have a somewhat annoying "bug" with Mozilla.

With IE when I click on a color, it adds the Hex Color Value (extracted from backgroundColor) correctly in the textarea like this :

http://www.kanako.free.fr/shared/iebug.jpg

But with Mozilla, it adds RBG Color Value instead!!

http://www.kanako.free.fr/shared/mozbug.jpg

Does anyone knows how I could fix this?

Here's the .js code (ah... and I forgot something -> I use PunBB+ with PunBB 1.1.2 "upgrade" wink)

function C(obj){
    var color;color=(obj.style)?obj.style.backgroundColor:obj.backgroundColor;
        formatThis('[color='+color+']', '[/color]');
}

and the function is called from each "colored" TD element (whom id property is set to "c0", "c1", ... "c35" - 35 colors available) with the onclick event handler :

C(this); //short isn't it? -> it was intended to be short

EDIT: Thanks anyway if you don't find a solution (I managed to wolve the problem now)

But I am still wondering if anybody had the same "problem" or if there was a "built-in feature" I didn't know that might had helped me a bit (why Mozilla had to convert Hex values to "rbg"? o_O This is really weird! No one would ever use those in HTML!

big_smile

Re: Help with CSS/javascript Color format problem with Mozilla...

wait a minute why shouldnt you use the rgb value instead if the hex value?
the rgb value is much simpler to work with and it you dont have to convert it

Im Jacks Broken Heart