dwz自己DIY的自适应查看图片

在表格中这里显示点击查看

<a onclick="getRealImg('${g.good_pic}',${status.count})" href="javascript:void(0);" title="图片显示">
<img id="${status.count}" src="${g.good_pic}" style="width:20px;height:20px;vertical-align: middle;">点击查看</a>
function getRealImg(pic_url,id) {
     var real_width,real_height;
    _im         = document.getElementById(id);
    im          = document.createElement('img');
    im.src      = _im.src;
    real_width  = im.width;
    real_height = im.height;
    $.pdialog.open('/mgr/goods/show?pic_url='+pic_url, 'goodPic', '图片', {'width':real_width,'height':real_height+50}); 
  }
    /**
     * 查看大图
     */
    public void show() {
        String pic_url = getPara("pic_url");
        setAttr("picUrl", pic_url);
        renderJsp("/mgr/pages/show.jsp");
    }

注意主从页面同时都有图片时,方法名称或者id设置为不一样,不然获取图片会混乱,导致大小不对

猜你喜欢

转载自blog.csdn.net/qq_15812507/article/details/53082822