Forum Moderators: open
function showDetailPopup(e, obj, id){
document.getElementById("detailpopup").innerHTML = document.getElementById(id).value;
document.getElementById("detailpopup").style.top = e.clientY + window.pageYOffset - 25;
document.getElementById("detailpopup").style.left = e.clientX + 10;
document.getElementById("detailpopup").style.visibility = 'visible';
}
I had this running on a test page and then added it to the page I wanted it to work on. Thing is.. it didn't.
The innerHTML and Visibility work fine but the style.top = ... and style.left = ... don't get the values.
Much frustration later I have found that the inclusion of the DOCTYPE tag was the culprite:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
I need this Doctype to display the page correctly, and don't understand why it should affect the positioning.
Has anyone any ideas?
Thanks.
ps: the div in the html is <div id="detailpopup"></div>
function showDetailPopup(e, obj, id){
document.getElementById("detailpopup").innerHTML = document.getElementById(id).value;
document.getElementById("detailpopup").style.top = e.clientY + window.pageYOffset - 25 + "px";
document.getElementById("detailpopup").style.left = e.clientX + 10 + "px";
document.getElementById("detailpopup").style.visibility = 'visible';
}