Jump to content

mulletman434

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by mulletman434

  1. <html><head><body><canvas id="button" onmouseover="myfunction()" onmouseout="myfunction2()" width="100" height="100"></canvas></body><script>var c=document.getElementById("button");var ctx=c.getContext("2d");function myfunction(){ctx.fillStyle="#ff0000";ctx.fillRect(0,0,100,100);}function myfunction2(){ctx.fillStyle="#c00000";ctx.fillRect(0,0,100,100);}</script></head></html>

    Ok problem solved but if there is a better way of doing this can some one tell me

  2. <html><body><canvas id="button" onmouseover="myfunction()" onmouseout="myfunction2()" width="150" height="150"></canvas></body><head><script>var c=document.getElementById("button");var ctx=c.getContext("2d");function myfunction(){ctx.fillStyle="#ff0000";ctx.fillRect(0,0,100,100);}function myfunction2(){ctx.fillStyle="red"; ctx.fillRect(0,0,100,100);}</script></head></html>

    Ok i did this it kinda works but it doesnt update i have a feeling i have things in the wrong place

  3. Tryit Editor<html><script>var c=document.getElementById("button");var ctx=c.getContext("2d");function myFunction(){ctx.fillStyle="#ff0000";ctx.fillRect(0,0,100,100);}function myFunction2(){ctx.fillStyle="red"; ctx.fillRect(0,0,100,100);}</script><body><canvas id="button" onmouseover="myfunction()" onmouseout="myfunction2()" width="100" height="100"></canvas></body></html>
    <html><script>var c=document.getElementById("button");var ctx=c.getContext("2d");function myFunction(){ctx.fillStyle="#ff0000";ctx.fillRect(0,0,100,100);}function myFunction2(){ctx.fillStyle="red";ctx.fillRect(0,0,100,100);}</script><body><canvas id="button" onmouseover="myfunction()" onmouseout="myfunction2()" width="100" height="100"></canvas></body></html>

    ok heres an updated one still wont work but it should.

  4. <html><body><canvas id="button" onmouseover="myfunction()" onmouseout="myfunction2()" width="100"height="100"></canvas><script> var c=document.getElementById("button");var ctx=c.getContext("2d");function myFunction(){ctx.fillStyle="#ff0000";}function myFunction2(){ctx.fillStyle="red";}</script></body></html>

    Pleaseeee can someone tell me what im doing wrong. all I want is a box that changes color when the mouse goes over it.

    • Like 1
×
×
  • Create New...