Display or Hide Inline Text

[Total: 0    Average: 0/5]

This shows how to have IE and NS6 display or not display inline components.

Head Code:

var isNS6=navigator.userAgent.indexOf("Gecko")!=-1?true:false;
var isIE=document.all?true:false;
function showhideinline(oDiv,flag){ 
  if (flag) oDiv.style.display="inline" //if flag true - show the div 
  else oDiv.style.display="none" 
else if(isNS6)
  if (flag) document.getElementById("oDiv").style.display="inline" //if flag true - show the div 
  else document.getElementById("oDiv").style.display="none" 


Body Code:

first <input type=checkbox onclick='showhideinline(a,this.checked)'> 
second <input type=checkbox onclick='showhideinline(b,this.checked)'> 
third <input type=checkbox onclick='showhideinline(c,this.checked)'><br> 
<div id=a class=tag> 
first div is here<br>first<br> 
<div id=b  class=tag> 
second div is here<br>second<br> 
<div id=c  class=tag> 
third div is here<br>third<br> 

Times Viewed: 3

Leave a Reply

Your email address will not be published. Required fields are marked *