<script>
function rgb2hex(r,g,b){
return '#'+(1<<24|r<<16|g<<8|b).toString(16).substring(1);
}
alert(rgb2hex(255,0,255));
</script>
function rgb2hex(r,g,b){
return '#'+(1<<24|r<<16|g<<8|b).toString(16).substring(1);
}
alert(rgb2hex(255,0,255));
</script>