Refael
asked on
show and hide JS/CSS
Hello experts,
I have an image of a house with hotspots links. Each hotspot should hide the initial house image and show the relevant image depending on the hotspot.
Here is the code:
"house 35" is showing in the right place (replacing the initial image but "house27" (the 2nd image) is showing down below the initial house.
How can I get "house27" to show where the initial image is like the initial image and "house35" is positioned?
I have an image of a house with hotspots links. Each hotspot should hide the initial house image and show the relevant image depending on the hotspot.
Here is the code:
<div id="house_container">
<div id="house"><img src="house.gif" usemap="#Map" /></div>
<div id="house35" style="visibility:hidden;"><img src="35.gif" usemap="#Map" /></div>
<div id="house27" style="visibility:hidden;"><img src="27.gif" usemap="#Map" /></div>
<map name="Map" id="Map">
<area shape="rect" alt="" coords="102,51,135,83" href="#" onmouseover="Hide('house'); Show('house35');" onmouseout="Hide('house35'); Show('house'); " />
<area shape="rect" alt="" coords="63,92,99,123" href="#" onmouseover="Hide('house'); Show('house27');" onmouseout="Hide('house27'); Show('house'); " />
</map>
</div>
---------------------------------------------
below is the JS code the page uses:
function Show(id) {
obj = document.getElementsByTagName("div");
if (obj[id].style.visibility == 'hidden'){
obj[id].style.visibility = 'visible';
}
if (obj[id].style.display == 'none'){
obj[id].style.display = 'block';
}
}
function Hide(id) {
obj = document.getElementsByTagName("div");
if (obj[id].style.visibility == 'visible'){
obj[id].style.visibility = 'hidden';
}
if (obj[id].style.display == 'block'){
obj[id].style.display = 'none';
}
}
----------------------------------------------------
"house 35" is showing in the right place (replacing the initial image but "house27" (the 2nd image) is showing down below the initial house.
How can I get "house27" to show where the initial image is like the initial image and "house35" is positioned?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.