[SOLVED] Hex values from a string
Posted: Thu Feb 03, 2005 12:15 pm
I have this string
#f700e2
or something similar (a hex color code)
How do I use javascript to get the red part (f7), the green part (00) and the blue part (e2) as hexadecimal values?
I tried
But it didn't work... Otherwise how can I convert the string "f7" obtained using substr() into it's decimal value?
Cheers
#f700e2
or something similar (a hex color code)
How do I use javascript to get the red part (f7), the green part (00) and the blue part (e2) as hexadecimal values?
I tried
Code: Select all
var redhex = 0xhexstring.substr(1,2) //Thought it would give 0xf7Cheers