<script language="javascript" type="text/javascript"> function getElementLeft(elm) { var x = 0; //set x to elm’s offsetLeft x = elm.offsetLeft; //set elm to its offsetParent elm = elm.offsetParent; //use while loop to check if elm is null // if not then add current elm’s offsetLeft to x //offsetTop to y and set elm to its offsetParent while (elm != null) { x = parseInt(x) + parseInt(elm.offsetLeft); elm = elm.offsetParent; } return x; } function getElementTop(elm) { var y = 0; //set x to elm’s offsetLeft y = elm.offsetTop; //set elm to its offsetParent elm = elm.offsetParent; //use while loop to check if elm is null // if not then add current elm’s offsetLeft to x //offsetTop to y and set elm to its offsetParent while (elm != null) { y = parseInt(y) + parseInt(elm.offsetTop); elm = elm.offsetParent; } return y; } function Large(obj) { var imgbox = document.getElementById("imgbox"); imgbox.style.visibility = 'visible'; var img = document.createElement("img"); img.src = document.getElementById(obj.id + "img").src;// obj.firstChild.src; // obj.src; img.style.width = '500px'; img.style.height = '400px'; if (img.addEventListener) { img.addEventListener('mouseout', Out, false); } else { img.attachEvent('onmouseout', Out); } imgbox.innerHTML = ''; imgbox.appendChild(img); imgbox.style.left = (getElementLeft(obj) - 50) + 'px'; imgbox.style.top = (getElementTop(obj) - 50) + 'px'; } function Out() { document.getElementById("imgbox").style.visibility = 'hidden'; } </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)