holty
04-03-2003, 07:31 PM
Hi,
I have a problem with some code that displays a nice little table display when a part of an imagemap is onmouse over. It works fine in IE but not in Netscape - any ideas?
<style>
.divstyle{position:absolute;
border:1px groove black;
width:150;
top:0;
left:0;
}
.pstyletitle{postion:absolute;
background:#0C5192;
color:white;
font-size:100%;
font-family:verdana;
heigth:50px;}
.pstylebody{postion:absolute;
background:#CBCBCB;
font-size:100%;
font-family:verdana;}
</style>
<script language="Javascript">
<!--
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0
var tempY = 0
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
} else { // grab the x-y pos.s if browser is NS
tempX = e.pageX
tempY = e.pageY
}
// catch possible negative values in NS4
if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}
// show the position values in the form named Show
// in the text fields named MouseX and MouseY
obj_info = document.getElementById("info")
obj_info.style.top = tempY + 10;
obj_info.style.left = tempX + 10;
return true
}
function alert_msg(titletext,bodytext){
obj_info = document.getElementById("info")
obj_info.style.display = '';
obj_imagetitle = document.getElementById("imagetitle");
obj_imagetitle.innerHTML = titletext;
obj_imagebody = document.getElementById("imagebody");
obj_imagebody.innerHTML = bodytext;
}
function away()
{
obj_info = document.getElementById("info")
obj_info.style.display = 'none';
}
//-->
</script>
<div Class="divstyle" id="info" style='display:none;'>
<div id="imagetitle" class="pstyletitle" align="center"></div>
<div id="imagebody" class="pstylebody"></div>
</div>
<img src="images/image.gif" border="0" usemap="#image" width="450" height="550">
<map name="image">
<area shape="rect" coords="218,25,195,43" href="#" onmouseover="alert_msg('Title','Description')"; onmouseout="away()";>
</map>
I have more hotspots but I have removed to make the post shorter!
Any help would be superb!
I have a problem with some code that displays a nice little table display when a part of an imagemap is onmouse over. It works fine in IE but not in Netscape - any ideas?
<style>
.divstyle{position:absolute;
border:1px groove black;
width:150;
top:0;
left:0;
}
.pstyletitle{postion:absolute;
background:#0C5192;
color:white;
font-size:100%;
font-family:verdana;
heigth:50px;}
.pstylebody{postion:absolute;
background:#CBCBCB;
font-size:100%;
font-family:verdana;}
</style>
<script language="Javascript">
<!--
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0
var tempY = 0
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
} else { // grab the x-y pos.s if browser is NS
tempX = e.pageX
tempY = e.pageY
}
// catch possible negative values in NS4
if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}
// show the position values in the form named Show
// in the text fields named MouseX and MouseY
obj_info = document.getElementById("info")
obj_info.style.top = tempY + 10;
obj_info.style.left = tempX + 10;
return true
}
function alert_msg(titletext,bodytext){
obj_info = document.getElementById("info")
obj_info.style.display = '';
obj_imagetitle = document.getElementById("imagetitle");
obj_imagetitle.innerHTML = titletext;
obj_imagebody = document.getElementById("imagebody");
obj_imagebody.innerHTML = bodytext;
}
function away()
{
obj_info = document.getElementById("info")
obj_info.style.display = 'none';
}
//-->
</script>
<div Class="divstyle" id="info" style='display:none;'>
<div id="imagetitle" class="pstyletitle" align="center"></div>
<div id="imagebody" class="pstylebody"></div>
</div>
<img src="images/image.gif" border="0" usemap="#image" width="450" height="550">
<map name="image">
<area shape="rect" coords="218,25,195,43" href="#" onmouseover="alert_msg('Title','Description')"; onmouseout="away()";>
</map>
I have more hotspots but I have removed to make the post shorter!
Any help would be superb!