Javascript Code : Random Display of Shapes with Different Colors using fillRect , clearRect, For Loop , Styling Buttons using Javascript
<!DOCTYPE html> <html> <head> <title> Javascript Code : Random Display of Shapes with Different Colors using fillRect , clearRect, For Loop , Styling Buttons using Javascript </title> </head> <body> <canvas id="myCanvas" width="1000" height="300" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas><br> Count the shapes <input type="number" id="answer" > </input> <button id="colors" onclick="colors()" onmouseover="colors()" >COLORS </button> <button id="eraser" onclick="eraser()" onmouseover="eraser()" >Next </button> <script> function colors() { var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); x=Math.round(Math.random()*10+1); var score=0; for(f=1; f<=x;f++) { swit...