perfectdesign
Programmer
I'm trying to adapt a script code that controls an mouseOver popup image, but each browser produces different results, and even the same browser on different platforms produce different results.
Here is the page in question : (just mouseOver the players name)
Here is the script code:
And here is the html code:
When tested on a Mac (OS X 10.3.9) -
in Opera the placement of the popup image is perfect
in Safari the image is too far down and to the left
in IE the script won't run at all (Error - Invalid procedure call or argument @ Line 13)
When tested on a PC (XP Home Service Pack 3)
in Opera the placement is perfect
in IE the placement is only slightly too far down
I can't find any rhyme or reason for the discrepancy and I've been stuck for days trying to figure it out. I'd really appreciate any help.
Crystal
Here is the page in question : (just mouseOver the players name)
Here is the script code:
Code:
<script type="text/javascript">
function ShowPopup(hoveritem)
{
hp = document.getElementById("hoverpopup");
var node = hoveritem;
var x = 450;
var y = 115;
while ( node != null )
{
x += node.offsetLeft;
y += node.offsetTop;
alert( x + "\n" + y );
node = node.offsetParent;
}
// Set position of hover-over popup
hp.style.top = y + "px";
hp.style.left = x + "px";
//Set popup to visible
hp.style.visibility = "visible";
}
function HidePopup()
{
hp = document.getElementById("hoverpopup");
hp.style.visibility = "Hidden";
}
</script>
And here is the html code:
Code:
<tr>
<td width="10%" align="center">
1
</td>
<td width="45%" align="center">
<a id="hoverover" style="cursor:default;" onMouseOver="ShowPopup(this);" onMouseOut="HidePopup();" href="bio/amentbio.php" target="_blank" onClick="window.open('bio/amentbio.php','Ryan Ament Bio','height=431,width=649,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); return false;">
Ryan Ament
</a>
<div id="hoverpopup" style="visibility:hidden; position:absolute; top:100px; left:350px;"><img src="bio/amentthumb.png"></div>
</td>
</tr>
When tested on a Mac (OS X 10.3.9) -
in Opera the placement of the popup image is perfect
in Safari the image is too far down and to the left
in IE the script won't run at all (Error - Invalid procedure call or argument @ Line 13)
When tested on a PC (XP Home Service Pack 3)
in Opera the placement is perfect
in IE the placement is only slightly too far down
I can't find any rhyme or reason for the discrepancy and I've been stuck for days trying to figure it out. I'd really appreciate any help.
Crystal