Skip to main content

Exercise 11: Counting Games (Finals Interactive)


 

(CODE FOR HTML:)

<!DOCTYPE html>

<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<title> Exercise 11: Counting Drill Game  </title>

<style>

html {

font-family: Consolas;

margin-left: 4%;

background-color: #cbc6dc;

    }

      

body {

max-width: 800px;

min-width: 480px;

    }

fieldset {

background-color: white;

}

button {

background-color: ##c4a59f;

color: black;

border-radius: 50%;

width: 100px;

height: 100px;

}

</style>

</head>


<body>


<h1>COUNT THE SHAPES</h1>

<p> THIS IS EXERCISE TO LEARN YOU HOW TO COUNT. "PRACTICE MAKES YOU PERFECT"</p>


<fieldset>

<canvas id="myCanvas" width="1200" height="300" style="border:none;">

</canvas>


<label> How many shapes do you see? </label>

<input type="number" id="answer"> </input>

<!-- <button id="colors" onclick="colors()" > Colors </button> -->

<button id="eraser" onclick="eraser()" > Next </button>

<button id="compare" onclick="compare();eraser()" > Answer </button>


<p> <b> Score: </b> </p> <div id="myScore"> 0 </div>


<p id="demo"> </p>


</fieldset>


<script type = "text/javascript">

var score=0;

function colors()

{

var canvas = document.getElementById("myCanvas");

var ctx = canvas.getContext("2d");

x=Math.round(Math.random()*10+1);

for(f=1; f<=x;f++)

{

switch(f)

{

case 1: c="#8ac489"; break

case 2: c="#8ac489";break

case 3: c="#8ac489"; break

case 4: c="#8ac489";break

case 5: c="#8ac489"; break

case 6: c="#8ac489"; break

case 7: c="#8ac489"; break

case 8: c="#8ac489"; break

case 9: c="#8ac489"; break

case 10: c="##8ac489"; break

}

ctx.font = "20px Calibri";

ctx.fillStyle=c;

ctx.fillRect(10+f*100,100, 50, 50);

}

}


function eraser()

{

var canvas = document.getElementById("myCanvas");

var ctx = canvas.getContext("2d");

ctx.clearRect(255,255,255); 

colors();

}


colors()


function compare()

{

ans=document.getElementById("answer").value


if (ans==x) {

score += 1;

document.getElementById("myScore").innerHTML=score.toString()

document.getElementById("demo").innerHTML="Correct"

}

else {

document.getElementById("demo").innerHTML="Wrong Try Again."

}

}

</script>


</body>

</html>

Comments

Popular posts from this blog

Exercise 10: Animation (Finals Web Prog)

(Code for HTML:) <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Exercise 010 Animated Web page</title> <link rel="stylesheet" href="Exercise10AnimatedWebpage.css"> </head> <body> <div> <h1 style="font-size:40px;"> ABOUT MYSELF  </h1> </div> <br> <br> <br> <br> <br> <br> <br> <br>  <p style="text-align: justify; text-indent: 50px;">  Hi I'm Jillian Marren Dela Cruz. You can call me "Jill or Jillian" i'm currently 3rd year Multimedia Arts Student. 20 years of Age. I chose multimeida because i want to enchance my skills and i'm willing to learn about everything. I'm November Babies and My zodiac sign is Sagittarius. The Sagittarius Traits is Curious and energetic, Sagittarius is one of the biggest travelers among all...

Exercise 12-14: Responsive Web Design, Tutorial Web Page and Activities Compilation

 PROJECT; Tutorial about how to do the Exercise 7: Select Box Price List First the Html code for this exercise is put the usually code the "<!DOCTYPE html> <html> <head>"  if you don't put this usually code then your labored to be made is nonsense so you need this and we will go to put this meta name "<meta name="viewport" content="width=device-width, initial-scale=1">" and the Title of what exercise are you doing like this "<title>Exercise 007: JavaScript Selected Value</title>"  and also you will link this html to the .css code or file like this  "<link rel="stylesheet" href="Exercise007SelectedValueinte2.css"> </head>" Next we will go to the main exercise that we will do how to do the Price List  don't forget the body "<body>" and like the title the main font of this exercise "<h1 class="font1"> Products & Pr...

Image

<!DOCTYPE html> <html> <head> <style> header { position:fixed; font-family: 'Arial Black'; top:0px; left:0px; width:98%; height:10%; color:#FFFFFF; background-color: #CBC6DC; background-repeat: no-repeat; background-attachment: fixed; background-size: 200% 50%; font-size: 50px; padding:15px; } footer {   text-align: center;   padding-top:20px;   padding-right: 200px;   padding-bottom: 700px;   padding-left: 325px;   background-color: #FFFFF;   color: black;   font-size: 12px;   width: 500px; }  body { background-image: url('jillian.jpg'); background-repeat: no-repeat; background-attachment: fixed;yy background-size: 100% auto; padding: 90px; color: white; font-family: "Arial Black"; font-size: 15px; text-align: center; } .frame1 { background-color: #CBC6DC; color: #FFFFFF; font-family: 'Arial Black'; margin-left: 0px; padding-top: 10px; padding: 10px; float: left; width: 517px; } .frame2 { backgr...