커서 위치에 layer 나타나게 하기
function showPhoto(imageFileName){
document.getElementById("photoImage").src = imageFileName;
var photoLayer = document.getElementById("photoLayer");
photoLayer.style.display = "block";
photoLayer.style.pixelLeft = document.documentElement.scrollLeft + event.x;
photoLayer.style.pixelTop = document.documentElement.scrollTop + event.y;
}
function hidePhoto(){
document.getElementById("photoLayer").style.display = "none";
document.getElementById("photoImage").src = "/image/photo.gif";
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
으로 DOCTYPE이 지정되었을 때는 document.body 대신 document.documentElement 사용해야 할 때가 있음
참고: http://www.quirksmode.org/js/doctypes.html
History
Last edited on 01/03/2008 15:05 by benelog
Comments (0)