Creating RGB color function, javascript error -
i'm trying create random colors using following function in javascript, getting error: syntax error: expected expression, got ')'. can tell me error message refers to?
function addevents(){
$('table').mouseover(function(){ var color = "rgb("; (var i=0; i<3; i++){ var random = math.round(math.random() * 255); color += random; if (i<2){ color += ","; } else { color += ")"; }; $(this).css('color', color); });
you're missing "}" in code
if (i<2){ color += ","; } else { color += ")"; } // <--- 1 missing
usually debugger show line number error occured at
Comments
Post a Comment