Is it possible to define a stylesheet for functions in js?
<canvas id="canv" onclick=loadContext() />
#canv {
width: 500px;
height: 200px;
background-color: darkblue;
}
function loadContext ()
{
var context = canv.getContext("2d");
/* use css-definition here? */
context.strokeStyle = "white";
context.beginPath();
context.moveTo(0, 0);
context.lineTo(300, 150);
context.stroke();
}
I'd like to use a definition in css instead of "white".
Thanks for your help. Joe