Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script>
- var punt=0;
- var valore=0;
- function tempo(){
- setInterval(random, 300);
- }
- function random(){
- for (i = 1; i < 10; i++) {
- document.getElementById(i).src="vuoto.png";
- }
- valore = Math.floor((Math.random() * 9) + 1);
- document.getElementById(valore).src="acceso.gif";
- }
- function checkt(num){
- if(valore==num){
- punt++;
- console.log(punt);
- document.getElementById("scorefinale").innerHTML=punt;
- }
- }
- </script>
- </head>
- <body>
- <center>
- <table>
- <tr>
- <tD><img src="vuoto.png" height="100" width="100" id=1 onclick=checkt(1)>
- <td><img src="vuoto.png" height="100" width="100" id=2 onclick=checkt(2)>
- <td><img src="vuoto.png" height="100" width="100" id=3 onclick=checkt(3)>
- <tr>
- <tD><img src="vuoto.png" height="100" width="100" id=4 onclick=checkt(4)>
- <td><img src="vuoto.png" height="100" width="100" id=5 onclick=checkt(5)>
- <td><img src="vuoto.png" height="100" width="100" id=6 onclick=checkt(6)>
- <tr>
- <tD><img src="vuoto.png" height="100" width="100" id=7 onclick=checkt(7)>
- <td><img src="vuoto.png" height="100" width="100" id=8 onclick=checkt(8)>
- <td><img src="vuoto.png" height="100" width="100" id=9 onclick=checkt(9)>
- </table>
- <button onclick=tempo()>Inizio</button><br>
- <font id=scorefinale size=10 color=#4286f4>0 </font><font size=10 color=#4286f4> Talpe</font>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement