<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<input type="file" name="upFile" onChange="document.getElementsByTagName('img')[0].src=this.value">
<img width="400" height="300">
</body>
</html>是这个意思吗?

解决方案 »

  1.   

    你就把你选择图片的连接地址赋给
    <img src='链接地址'> 
      

  2.   


    对,但是怎么让IMG显示出我选择的图片呢?
      

  3.   


    我说的是用JS做,不是给img固定图片
      

  4.   


    说了 就把地址赋给img就行了
      

  5.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
    "http://www.w3.org/TR/html4/loose.dtd">  
    <html>  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
    <title>文档  </title>  
    </head>  <body>  
    <input type="file" name="upFile" onChange="document.getElementsByTagName('img')[0].src=this.value">  
    <img width="400" height="300">  
    </body>  
    </html>没理由 你就选择你本地盘符下的图片试下阿
      

  6.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
    "http://www.w3.org/TR/html4/loose.dtd">  
    <html>  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
    <title>文档  </title>
    <script>
    function chkimg(value){
    document.getElementsByTagName('img')[0].src="file:///"+value
    }
    </script>   
    </head>  <body>  
    <input type="file" name="upFile" onChange="chkimg(this.value)">  
    <img width="400" height="300" id="xsimg" src="F:\yb.jpg">  
    </body>  
    </html>
      

  7.   

    如果是用的IE7,以上代码是无效的。
    DHTML
     <div id="pic" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:300px;height:250px; overflow:auto">                    
                           </div>js
     document.getElementById("pic").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = url
      

  8.   

    我也是菜鸟,请问“document.getElementsByTagName('img')[0].src=this.value”中的“[0]”是什么意思?
      

  9.   

    上周做了一个web图片浏览器,给编辑用的,很麻烦.
    搞了有一周,不过效果很酷.