Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Show div on link rollover

// Show div on link rollover

<html>
<head>
<script>
function layerSetup(id,visibility){
if(document.getElementById){
this.obj = document.getElementById(id).style;
this.obj.visibility = visibility;
return this.obj;}
else if(document.all){
this.obj = document.all[id].style;
this.obj.visibility = visibility;
return this.obj;}
else if(document.layers){
this.obj = document.layers[id];
this.obj.visibility = visibility;
return this.obj;}
}
function visVisible(param){
new layerSetup(param,'visible');
}

function visHidden(param){
new layerSetup(param,'hidden');
}
</script>
</head>

<body>
<a href="#" onmouseover="visVisible('id1')" onmouseout="visHidden('id1')">SHOW1</a> 
<a href="#" onmouseover="visVisible('id2')" onmouseout="visHidden('id2')">SHOW2</a>
<a href="#" onmouseover="visVisible('id3')" onmouseout="visHidden('id3')">SHOW3</a><br>

<br>
<br>
<div id="id1" style="visibility: hidden;">ID1</div><br>
<div id="id2" style="visibility: hidden;">ID2</div><br>
<div id="id3" style="visibility: hidden;">ID3</div>
</body>
</html>

You need to create an account or log in to post comments to this site.