Version - 1 - 1-38
This commit is contained in:
25
Version - 6/index.html
Normal file
25
Version - 6/index.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>HTML</title>
|
||||
|
||||
<!-- HTML -->
|
||||
|
||||
|
||||
<!-- Custom Styles -->
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="button1">
|
||||
<img src = 'https://i.postimg.cc/rdcChfG6/Notpressed.png' id="red">
|
||||
<img src = "https://i.postimg.cc/rdJG75gD/Pressed.png" id="green">
|
||||
</div>
|
||||
<script src="main.js"></script>
|
||||
<p id="clicks"></p>
|
||||
</body>
|
||||
</html>
|
||||
24
Version - 6/main.js
Normal file
24
Version - 6/main.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var count = 0;
|
||||
window.onload = function(){
|
||||
count = localStorage.getItem('count');
|
||||
document.getElementById('clicks').innerHTML=count;
|
||||
var red = document.getElementById('red');
|
||||
var green = document.getElementById('green');
|
||||
var button = document.getElementById('button1');
|
||||
button.ontouchstart = function(){
|
||||
red.style.visibility='hidden';
|
||||
green.style.visibility='visible'
|
||||
count++;
|
||||
localStorage.setItem('count',count);
|
||||
document.getElementById('clicks').innerHTML=count;
|
||||
}
|
||||
button.ontouchend=function(){
|
||||
red.style.visibility='visible';
|
||||
green.style.visibility='hidden'
|
||||
}
|
||||
}
|
||||
function reset(){
|
||||
localStorage.removeItem('count');
|
||||
count=0;
|
||||
document.getElementById('clicks').innerHTML=count;
|
||||
}
|
||||
23
Version - 6/style.css
Normal file
23
Version - 6/style.css
Normal file
@@ -0,0 +1,23 @@
|
||||
body {
|
||||
font-size: 15pt;
|
||||
user-select: none;
|
||||
}
|
||||
#red{
|
||||
position: absolute;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
|
||||
|
||||
}
|
||||
#green{
|
||||
position: absolute;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
visibility: hidden;
|
||||
}
|
||||
#button1{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -150px 0 0 -150px;
|
||||
}
|
||||
Reference in New Issue
Block a user