All Hail the New standards

With the move by later browsers to support a more standard DOM we can replace both bits of code with

document.getElementById('picture').style.visibility='hide'

document.getElementById() is the new and cross browser way to access any element on a web page by its id attribute.

Note the case of the letters in getElementById

New DOM example This example where we hide and show an image of a Rose should work cross browser.

Here is the code
<head>  
<title>Mike Capstick's new hide and show example</title>
<script type='text/javascript'>  
<!--  
function hideme(){ 
  if (document.getElementById('graphic').style.visibility=='hidden')
     {document.getElementById('graphic').style.visibility='visible';}
 else{document.getElementById('graphic').style.visibility='hidden';}  
}  
//-->  
</script>  
</head>  
<body style='text-align:center;background-color:#eeffee;'>  
<div  style='position:relative;' id='graphic'><img src='rose.gif' alt='rose' /></div>  
<form action=''>  
<input type ='button'  value='hide/show' onclick='hideme();' />  
</form>  
</body>