Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <style type="text/css">
    .i {display: block;
        
        color: white;}
  </style>
</head>
<body>
  <a href="#" onclick="prev();">Back</a>
  <div>
    <div class="i" id="d0">0</div>
    <div class="i" id="d1">1</div>
    <div class="i" id="d2">2</div>
    <div class="i" id="d3">3</div>
    <div class="i" id="d4">4</div>
    <div class="i" id="d5">5</div>
    <div class="i" id="d6">6</div>
    <div class="i" id="d7">7</div>
    <div class="i" id="d8">8</div>
    <div class="i" id="d9">9</div>
    <div class="i" id="d10">10</div>
    <div class="i" id="d11">11</div>
  </div>
</body>
</html>
 
            var i = 11;
            var id;
            function prev() 
            {
                if(i<0) i=11;
                id = 'd'+i;
                id1 = 'd'+i+1;
                var el = document.getElementById(id);
                var pel = document.getElementById(id1);
  
                if(el.style.display=="block") 
                {
                    el.style.display = "none";
                    i--;
                } 
                else
                {
                    el.style.display = "block";
                    pel.style.display = "none";
                    i--;
                }
            }
            
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers