Terminator004,
не плодите темы!
<!Doctype html>
<html>
<head>
<title>Taskai</title>
<meta charset="utf-8">
<script>
window.addEventListener("DOMContentLoaded", function() {
function taskai() {
var a = +prompt("iveskite skaiciu");
var b = +elem.innerHTML + +a;
localStorage.setItem("taskai", b);
elem.innerHTML = b
}
var elem = document.getElementById("taskas");
elem.innerHTML = localStorage.getItem("taskai") || "";
document.getElementById("mygtukas").addEventListener("click", taskai);
function anuliuojam() {
elem.innerHTML = "0";
localStorage.setItem("taskai", "0")
}
document.getElementById("anuliuoti").addEventListener("click", anuliuojam)
});
</script>
</head>
<body>
<input type="button" id="mygtukas" value="Taskai" ></input>
<input type="button" id="anuliuoti" value="Anuliuoti" ></input>
<div>
Taskai:
<span id="taskas"></span>
</div>
</body>
</html>
|