Guess Number GAME : HTML
Python is pretty good language but HTML is pretty web language...
so, in first semester I wrote a python code for guess number game, but, now we will learn how to make a guess number game using HTML...
so below is the code for it, I will try to upload all my codes on github... and will share a link with you.
But for now consider the below mentioned code, in HTML and styling using internal CSS.
Code:
<!DOCTYPE html> <html> <head><title></title></head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <style> body{ background : url("https://cdn.pixabay.com/photo/2015/01/08/15/54/lines-593191_960_720.jpg"); } h1{ margin-top: 10px; font-family: cursive; color: black; background: white; } table{ padding-top: 20px; border: 10px solid purple; padding-left: 60px; padding-bottom: 20px; } td{ width: 20%; height: 20%; } button{ width: 100px; height: 100px; font-size: 40px; box-shadow: 2px 3px; background: url("https://cdn.pixabay.com/photo/2017/03/25/17/55/color-2174045_960_720.png"); font-family: cursive; } span{ font-size: 20px; font-family: cursive; /*background: black;*/ color: white; } </style> <script> function see1(){ document.getElementById("1").innerHTML = "R"; } function see4(){ document.getElementById("4").innerHTML = "R"; } function see7(){ document.getElementById("7").innerHTML = "R"; } function see9(){ document.getElementById("9").innerHTML = "R"; } function see6(){ document.getElementById("6").innerHTML = "R"; } function seeNot2(){ document.getElementById("2").innerHTML = "W"; } function seeNot3(){ document.getElementById("3").innerHTML = "W"; } function seeNot5(){ document.getElementById("5").innerHTML = "W"; } function seeNot8(){ document.getElementById("8").innerHTML = "W"; } function seeNot10(){ document.getElementById("10").innerHTML = "W"; } </script> <body> <center> <h1>Guess The Number Game...</h1> <table> <tr> <td><button onclick="see1()" id="1">1 </button></td> <td><button onclick="seeNot2()" id="2">2 </button></td> <td><button onclick="seeNot3()" id="3">3 </button></td> </tr> <tr> <td><button onclick="see4()" id="4">4 </button></td> <td><button onclick="seeNot5()" id="5">5 </button></td> <td><button onclick="see6()" id="6">6 </button></td> </tr> <tr> <td><button onclick="see7()" id="7">7 </button></td> <td><button onclick="seeNot8()" id="8">8 </button></td> <td><button onclick="see9()" id="9">9 </button></td> </tr> <tr><td></td> <td><button onclick="seeNot10()" id="10">10</button></td> </tr> </table> </center> <span>Here R = RIGHT & W = Wrong<br>Press F5 To restart :) </span> </body> </html>
OUTPUT:
After clicking the number buttons, the output would be:
Comments
Post a Comment