jaymc Posted November 6, 2007 Share Posted November 6, 2007 I am using javascript to get the BackgroundColor of a div It is working fine in IE However, in firefox rather than give the hex such as #fff000 it gives this rgb(255, 255, 0) This wouldnt be a problem as IE can also read <font color="rgb(255, 255, 0)";> but, firefox cant!! This is driving me nuts, any ideas? I preferably want firefox to pick out the hex Quote Link to comment Share on other sites More sharing options...
fenway Posted November 6, 2007 Share Posted November 6, 2007 Why not just interconvert? Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 6, 2007 Author Share Posted November 6, 2007 How I need to do it in both javascript and php due to the nature of the script What are the functions do you know for both languages Quote Link to comment Share on other sites More sharing options...
fenway Posted November 6, 2007 Share Posted November 6, 2007 I assume you're setting it / reading it... just convert 255 <-> FF. It's a simple hex-to-decimal function. Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 6, 2007 Author Share Posted November 6, 2007 It will not always be the same decimal value http://javascript.about.com/library/blh2d.htm Cheers Quote Link to comment Share on other sites More sharing options...
fenway Posted November 6, 2007 Share Posted November 6, 2007 It will not always be the same decimal value What won't be? Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 6, 2007 Author Share Posted November 6, 2007 Ok that d2h isnt working i think it only accepts this for instance d2h(255) rather than d2h(255, 255, 0) Is this the case? Will I have to split it by , to get each value This is becoming tricky Quote Link to comment Share on other sites More sharing options...
fenway Posted November 6, 2007 Share Posted November 6, 2007 Yes, you'll have to parse it out.... unless someone has already written a function to that do. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.