Color in Java Scripts
post and replies
Return to the Color in Java Scripts thread
Login to post to this thread
Java versus Java Script
|
Fernando Silva Fernandes
10 Posts
|
In Java, declaring a variable (x) as an object:
x = Color.RED;
it's OK.
The same thing in Java Script gives the error :"Color is not defined".
How to do it in EJsS?
|
Re: Java versus Java Script -
|
Wolfgang
192 Posts
|
JavaSscript does not have a Color class but you can create a color variable using any of the standard color names; For example:
var c="Red";
Known color names are listed here: http://www.w3schools.com/cssref/css_colornames.asp
You can use the rgb function of you can create a function that returns a color from three integers:
function rgb(r, g, b){ return "rgb("+r+","+g+","+b+")"; }
|
Re: Re: Java versus Java Script -
|
Fernando Silva Fernandes
10 Posts
|
Many thanks for your help.
I'll try it asap.
Fernando
|
|