Eduard Witteveen wrote:
But i now have the problem that inserting the iframe into the page
triggers a mouseMove,... And since the load is finished after the
showHooverBox method, i cant stop it from happening,.. Any suggestions?
(i was thinking of not using a iframe, but putting the content of the
details.html hard in the the dhtml structure, but i dont know how to
issue a request from javascript
I fixed this by using the following code:
<html>
<head>
<script type="text/javascript" src="sarissa/sarissa.js"></script>
</head>
<body>
</body>
<script language="javascript">
var HOOVER_BAR = "HOOVER_BAR";
function showHooverBox(x,y) {
if(!hooverBarVisible) {
var hoover = document.getElementById(HOOVER_BAR);
hoover.style.display = "block";
hoover.style.position = "absolute";
hoover.style.borderWidth = "1px";
hoover.style.borderStyle = "solid";
hoover.style.backgroundColor = "#ffffbb";
hoover.style.left = x;
hoover.style.top = y;
// retrieve the dynamic content
var oDom = Sarissa.getDomDocument();
oDom.async = false;
oDom.load("details.aspx?x=" + x + "&y=" + y);
// alert(oDom.xml);
hoover.innerHTML = oDom.xml;
}
hooverBarVisible = true;
}
function hideHooverBox() {
if(hooverBarVisible) {
var hoover = document.getElementById(HOOVER_BAR);
hoover.style.display = "none";
}
hooverBarVisible = false;
}
var last_xpos;
var last_ypos;
var current_xpos;
var current_ypos;
// update the last movement
function mouseMove(e) {
current_xpos = event.x;
current_ypos = event.y;
hideHooverBox();
}
function mouseHooverCheck() {
if(current_xpos && current_ypos
&& current_xpos == last_xpos
&& current_ypos == last_ypos)
{
showHooverBox(current_xpos, current_ypos);
}
last_xpos = current_xpos;
last_ypos = current_ypos;
}
// attach the function to the mouse movement
document.onmousemove = mouseMove;
// callback is invoked after 0.5 seconds
window.setInterval(mouseHooverCheck, 500);
// add div, so we can put information in it, when needed
var hooverBarVisible = false;
var hoover = document.createElement("div");
hoover.id = HOOVER_BAR;
hoover.innerText = "[This text has to replaced by code from a certain
url]";
hoover.style.display = "none";
document.body.appendChild(hoover);
</script>
</html>