[View full width]
[View full width]
prevWin.innerHTML = (xhr.status == 200)? xhr.responseText : "There was a problem with the request " + xhr.status; prevWin.style.top = parseInt(yPos)+ 2 + "px"; prevWin.style.left = parseInt(xPos)+2 + "px"; prevWin.style.visibility = "visible"; prevWin.onmouseout = hidePreview;
If everything's fine, then
xHR.status is 200 and the data we want to put into
prevWin.innerHTML is in
xhr.responseText . If not, we put the error message there instead.
Once that's done, it's simply a matter of figuring out where to place the preview window, and that's where those
x and
y mouse coordinates come in handy. It's a pop-up, so we put it just below and to the right (2 pixels over and 2 down) of the cursor position that triggered this call.
Lastly, we set
prevWin to be visible, and we let JavaScript know that
prevWin should be hidden when the cursor moves off the preview.