PDA

View Full Version : hide multiple layers from one function


chris_angell
02-18-2003, 10:07 PM
hello. please help

I am trying to hide 2 div or layers of one function

I want to have a function

hide(object,object1) and hide the two divs they relate to.. can you help

here is my code for one

<html>

<head>

<script language="JavaScript">
<!--
function show(object) {
if (document.getElementById) {
document.getElementById(object).style.visibility = 'visible';
}
else if (document.layers && document.layers[object]) {
document.layers[object].visibility = 'visible';
}
}

function hide(object) {
if (document.getElementById) {
document.getElementById(object).style.visibility = 'hidden';
}
else if (document.layers && document.layers[object]) {
document.layers[object].visibility = 'hidden';
}
}
//-->
</script>

</head>

<body>


<a href="#" onMouseOver="hide('layer1,layer2')">hide </a>
<a href="#" onMouseOver="show('layer1')">show</a>

<div id="layer1">layer 1</div>
<div id="layer2">layer 2</div>

A1ien51
02-18-2003, 10:48 PM
why don't you just call it twice? There will just be a ms of difference in time, and no one will notice

onmouseover="hide('1');hide('2');"

chris_angell
02-18-2003, 11:23 PM
i DID THINK ABOUT THAT BUT i WAS TRYING TO KEEP MY CODE CLEANER.. i HAVE LOTS OF OTHER FUNCTIONS WITHIN MY PAGE SO IF i COULD JUST PUT

oppppppps caps.. sorry my head was down and typing.. plus I have had a couple of beers


umm hide('1,2')

I would be happy..

thanks very much anyway

:o

A1ien51
02-19-2003, 07:16 AM
you could just double up the lines of code in the function