0

I'm working on a color switching drawing. The switch is two buttons the first is changing the colours the other one draws the new picture. I found this problem: After I switched on and off once the buttons don't do anyhing visible. Any suggestions how to solve it? (I'm a beginner--> I apperciate simple solutions)

<script>
var d = document.getElementById("1")
var dtx = d.getContext('2d');
var C;
var L;

function Func()
{
if (isFinite(L))
    {   C = ["#33FFFF","#993300"];
        L="A";
    }
else
        C = ["#33CCCC","#663300"];
        L="1";
}
function Draw()
{
    dtx.clearRect(0, 0,d.width, d.height);
    dtx.fillStyle= C[0];
    dtx.fillRect(20,20,20,20);
    dtx.beginPath();
    dtx.fillStyle= C[1];
    dtx.fillRect(60,60,20,20);
}
</script>

0 Answers0