Eccoti come ho fatto io... la funzione toRGB ti converte nel formato che vuoi tu... nel caso che invece sia già nel formato corretto restitusce la stringa stessa... questo perchè internet explorer restituisce il colore nel formato che vuoi tu.....
codice:
function DecToHex(n)
{
hex=n.toString(16);
if(hex.length==1) hex="0"+hex;
return hex.toUpperCase();
}
function toRGB(s)
{
if (s.substr(0,1) == "#")
return s.toUpperCase();
sx = s.indexOf("(");
dx = s.indexOf(")");
lungh = dx - sx - 1;
s1 = s.substr(sx + 1,lungh)
splitted = s1.split(",")
splitted[0] = splitted[0].replace(" ","");
splitted[1] = splitted[1].replace(" ","");
splitted[2] = splitted[2].replace(" ","");
result = "#" + DecToHex(parseInt(splitted[0])) + DecToHex(parseInt(splitted[1])) + DecToHex(parseInt(splitted[2]));
return result.toUpperCase();
}
ciaooooooooooooooo