z - order javascript


   /* NOTE:!!!  'zIndex'  is javaScript while 'z-index' is CSS
      moves image to "front" when u CLICK ON IMAGE
   */
   function toFront(num)
   {
        // get style references
        img1 = document.getElementById("i1").style;
        img2 = document.getElementById("i2").style;
        img3 = document.getElementById("i3").style;
        
        // make it SEEN
        img1.visibility="visible";
        img2.visibility="visible";
        img3.visibility="visible";        
        
        // uses parameter to "stack" images
        // higher number goes to front
        if(num == 1)
        {
           img1.zIndex = "1"; img2.zIndex = "0"; img3.zIndex = "0";
        }
        if(num == 2)
        {
           img1.zIndex = "0"; img2.zIndex = "1"; img3.zIndex = "0";
        }
        if(num == 3)
        {
           img1.zIndex = "0"; img2.zIndex = "0"; img3.zIndex = "1";
        }   
   }

   
   /* show ONLY selected image via radio button */
   function changeImage(num) 
   {
        // get style references
        img1 = document.getElementById("i1").style;
        img2 = document.getElementById("i2").style;
        img3 = document.getElementById("i3").style;
        
        // use param 
        if(num == 1) 
        {
          img1.visibility = "visible";   
          img2.visibility = "hidden"; 
          img3.visibility="hidden";
        }
        if(num == 2) 
        {
          img2.visibility = "visible";
          img1.visibility = "hidden"; 
          img3.visibility="hidden";
        }  
        if(num == 3) 
        {
          img3.visibility = "visible";
          img2.visibility = "hidden"; 
          img1.visibility="hidden";
        }  
   }

    
   function showDOM() 
   {
      /* DISPLAY THE DOC TITLE */
      
      // get reference
      var o = document.getElementById("domstuff");
      
      // build the string
      var s="";
      s+="Title is " + document.title + "
"; s+="Domain is " + document.domain + "
"; s+="URL is " + document.URL + "
"+ "
"; s+="  Why are the 6 BRs the last tags shown??" + "
"+ "
"; // replace current text with new text from string o.innerHTML = s; // get all the tags with an id // add each tag to the string, "displaystring" var tags = document.getElementsByTagName("*"); var displayString = ""; // get each one and then add a break so they will be displayed on separate lines for ( var i = 0; i<tags.length; i++ ) { displayString += tags[i].nodeName + "
"; } // show all the tags used o.innerHTML += "Tags are: " + "
" + displayString + "
"; }