本帖最后由 singlett 于 2013-10-27 13:47:05 编辑

解决方案 »

  1.   

    你可以在一个区域先放一个img标签 之后点击图片后设置这个img的src
    可以通过设置img的width和height改变图片的大小
      

  2.   

    麻烦您能再讲的详细一些么,比如说我现在用的是whitebox作为这个区域,然后我把它换成一个图片,但是点击了之后怎么在设置大小呢,我刚学这些,实在是不太明白。能不能给下代码,谢谢啦。
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style type="text/css">
    body>img{
    width:100px;
    }
    div>img{
    opacity:0;
    filter:alpha(opacity=0);
    }
    </style>
    <script type="text/javascript">
    var p="";
    window.onload=function(){
    var imgs=document.body.childNodes;
    var show=document.getElementById("show");
    for(var i=0,len=imgs.length;i<len;i++){
    if(imgs[i].tagName=='IMG'){
    imgs[i].onclick=function(){
    show.src=this.src;
    shows(show,0);
    }
    }
    }
    }
    function shows(dom,d){
    if(p){
    window.clearTimeout(p);
    }
    dom.style.opacity=d/100;
    dom.style.filter="alpha(opacity="+d+")";
    d+=10;
    p=window.setTimeout(function(){shows(dom,d)},200);
    if(d==100){
    window.clearTimeout(p);
    }
    }
    </script>
    </head><body>
    <img src="1.jpg" />
    <img src="2.jpg" />
    <div>
    <img src="" id='show'/>
    </div>
    </body>
    </html>
    类似这样试试