上一篇: 下一篇:

js弹出div显示大图片

2010年02月19日  |  11:59分类:长沙网站设计  |  标签:  |  1,630 views

js弹出div显示大图片代码:

可以根据需要放大的倍数调整width的大小,即下面的粉红色的200.

/**
     *鼠标移入显示放大的图片
    */
function mousein(t){
var ei = document.getElementById(”big_image”);
ei.style.display = “block”;
ei.innerHTML = ‘<img src=”‘ + t.src + ‘” width=+200+”%” />’;
ei.style.top = document.documentElement.scrollTop +window.event.clientY+10+”px”;
    ei.style.left =window.event.clientX+30+”px”;
}

/**
      *鼠标移出隐藏大图片
     */
function mouseout(){
var ei = document.getElementById(”big_image”);
ei.innerHTML = “”;
ei.style.display = “none”;
}

调用方法:

<div id=”big_image” style=”position: absolute; display: none; z-index: 2; border: 0px solid #f4f4f4;”></div><img src=”images/free.gif” alt=”” title=” A ” width=”100″ height=”80″ onMouseMove=”mousein(this);” onMouseOut=”mouseout(this);”/></a>

经过本人测试使用,绝对可行。

原创文章,转载请注明: 转载自长沙营销型网站建设,营销型网站开发,Zen-Cart | 小龙包

本文链接地址: js弹出div显示大图片

喜欢本文,那就收藏到: Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网

发表您的评论

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word