今天整理代码发现了:
<script>
function hideLayer()
{
var layer = document.getElementById("popImageLayer");
layer.style.visibility='hidden';
}
function dispear(){
var layer = document.getElementById("popImageLayer");
if ((layer.style.width>0)&& (layer.style.height>0)){
layer.style.width-=1;
layer.style.height-=1;
}
else {
layer.style.visibility='hidden';
if (window.interval)
clearInterval(interval);
}
}
function popImage(obj,img,href)
{
var layer = document.getElementById("popImageLayer");
var t=obj.offsetTop;
var l=obj.offsetLeft;
while(obj=obj.offsetParent){
t+=obj.offsetTop;
l+=obj.offsetLeft;
}
////////////////////////////////////////////////////////////
var content = "<table border=0 width=180 height=180><tr><td align='center' valign='middle'>\n"+
"<A href="+href+" target=_blank><IMG src='"+img+"' onload='DrawImage(this,180,180);'
onMouseOut='low(this);hideLayer();' onMouseOver=high(this) style='FILTER: alpha(opacity=10)' border=1></A></td></tr></table>"; // onClick='hideLayer();'
/////////////////////////////////////////////////////////////
layer.innerHTML=content;
layer.style.left =l + 35 -90;
layer.style.top = t+35-90;
layer.style.visibility='visible';
}
function moveToMouseLoc(e)
{
var layer = document.getElementById("popImageLayer");
var offsetX = -5;
var offsetY = -5;
var x = event.x + document.body.scrollLeft;
var y = event.y + document.body.scrollTop;
layer.style.left = x + offsetX;
layer.style.top = y + offsetY;
return true;
}
function DrawImage(img,width,height){
if(DrawImage.arguments.length <= 1)
width=height=70;
var image=new Image();
image.src=img.src;
if(image.width>0 && image.height>0)
{
if(image.width>width)
{
rate=image.height/image.width;
newHeight=rate*width;
img.width=width;
img.height=newHeight;
}
}
if(img.height>height)
{
rate=image.width/image.height;
newWidth=rate*height;
img.height=height;
img.width=newWidth;
}
}
function DrawImage50(img){
DrawImage(img,50,50);
}
function high(which2){
theobject=which2;
highlighting=setInterval("highlightit(theobject)",40);
}
function low(which2){
clearInterval(highlighting);
which2.filters.alpha.opacity=40;
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
}
function delightit(cur2){
if (cur2.filters.alpha.opacity>5)
cur2.filters.alpha.opacity-=5;
else if (window.highlighting)
clearInterval(highlighting);
}
</script>
<div id="popImageLayer" align="center"
name="popImageLayer"
style="position:absolute; visibility: hidden; width: 180; height: 180;cursor: hand;border-style:solid;border-width:1pt; border-color:orange" calss=""></div>
<center>
<br /><br /><br />
<img src="admin.mall. target="_blank">http://admin.mall. ... nbsp;onMouseOver="popImage(this,'admin.mall. target="_blank">http://admin.mall. ... /200608090909231.png','http://wangfenglitai.mall. ... uot; border=0></a>
</center>
图片地地址可能要改下才,我没有重新测试~