<!DOCTYPE html>
<html>
<head>
</head>
<body>
n = <span id="toggle">1</span> <button onclick="ToggleThis()">Show Or Hide</button>
<div id="oneToHide">Hide Me!</div><br>
<script>
function ToggleThis(){
var number; // Тот самый "0" или больше
number = (++(document.getElementById("toggle").innerHTML))%2;
document.getElementById("toggle").innerHTML = number;
ShowOrHide(number);
}
function ShowOrHide(number){
if (number==0){
document.getElementById("oneToHide").style.display = 'none';
}
if (number>0){
document.getElementById("oneToHide").style.display = 'block';
}
}
</script>
</body>
</html> |