在IE下正常,在FF下,图片并没有按设置的大小显示,好像在FF下失效.<script language="javascript" type="text/javascript">
/*触发事件*/
function mouse_0(obj){
var imgbox=document.getElementById("imgbox");
imgbox.style.visibility='visible';
var img = document.createElement("img");
img.src=obj.src;
img.style.width=obj.width * 4;
img.style.height=obj.height * 4;
imgbox.innerHTML='';
imgbox.appendChild(img);
}
/*移动事件*/
function mouse_1(obj,e){
var browerHeight=document.documentElement.clientHeight; //浏览器高度
var browerWidth=document.documentElement.clientWidth; //浏览器宽度
var mouseY=e.clientY; //当前光标Y位置
var mouseX=e.clientX; //当前光标X位置
var scrollTop=document.documentElement.scrollTop; //垂直滚动条距离顶部
var scrollLeft=document.documentElement.scrollLeft //水平滚动条距离左边
if (mouseY+obj.height * 4 + 20 <= browerHeight) var height = true; //当前光标Y位置 + 对象高度 <= 浏览器高度 ,则height为真
if (browerWidth-mouseX > mouseX) var width = true; //光标距离右边如果大于左边 ,则width为真
if(height)
y=scrollTop+mouseY+20;
else
y=scrollTop + browerHeight-obj.height * 4 - 20;
if(width)
x=scrollLeft+mouseX+20;
else
x=scrollLeft+mouseX-obj.width * 4 -20;
document.getElementById("imgbox").style.left=x + "px";
document.getElementById("imgbox").style.top=y + "px";
}
/*离开事件*/
function mouse_2(){
document.getElementById("imgbox").style.visibility='hidden';
}
</script>