原文引自:
http://blog.donews.com/lveyo/archive/2006/03/15/769093.aspx<html>
<head>
<title>emu</title>
</head>
<body>
<BR>
<BR>
<img src="http://img.pconline.com.cn/images/photo2/839980/1118509777696.JPG" onmousemove="zoom()" id=srcImg>
<BR>
<BR>
<div style="overflow:hidden"><img id=zoomImg></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
zoomImg.src = srcImg.src;
srcImg.height = srcImg.height/2;
var zoomRate = 5;
zoomImg.height = srcImg.height*zoomRate;
zoomImg.parentNode.style.width = srcImg.width;
zoomImg.parentNode.style.height = srcImg.height;
function zoom(){
var elm = event.srcElement;
h = elm.offsetHeight/zoomRate/2;
w = elm.offsetWidth/zoomRate/2;
var x = event.x-elm.offsetLeft;
x=x<(elm.offsetWidth-w)?x<w?w:x:elm.offsetWidth-w;
zoomImg.style.marginLeft=(w-x)*zoomRate;
var y = event.y-elm.offsetTop;
y=y<(elm.offsetHeight-h)?y<h?h:y:elm.offsetHeight-h;
zoomImg.style.marginTop=(h-y)*zoomRate;
}
//-->
</SCRIPT>
</body>
</html>
Trackback: http://tb.donews.net/TrackBack.aspx?PostId=769093