<script language="javascript">
function view()
{
document.form1.imgg.src=document.form1.file1.value;
}</script>
</head>
<body>    <form id="form1" runat="server">
<INPUT   TYPE="file"  id="file1"  onchange="view()">   
<img id="imgg" src="" alt="dddd" width="240"  height="180"/>
    </form>
</body>
</html>

解决方案 »

  1.   

    就当长个教训吧,以后不要写这种       ("IE5"和"IE6"专用语法)  的代码.  你说的不对,不是IE7 不行其他浏览器都可以,   我刚试了火狐1.5 和Opera 都不可以.只有IE5和IE6内核的浏览器(就是那些只有外壳的"假浏览器"如TT,傲游之类的)可以.
    以后请用标准的代码来写,总共不过多打10几个字母罢了. 以后别这么写就行了,没什么好郁闷的.
      

  2.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>    <script type="text/javascript" language="javascript">
    function view()
    {
    document.getElementById("imgg").src=document.getElementById("file1").value;
    }    </script></head>
    <body>
        <form id="form1" runat="server">
            <input type="file" id="file1" onchange="view()" />
            <img id="imgg" src="" alt="dddd" width="240" height="180" />
        </form>
    </body>
    </html>
    刚刚在IE5,6,7, Opera,火狐,网景都测试过完全正常
      

  3.   

    document.form1.imgg.src=document.form1.file1.value;
    改为:
    document.getElementById("imgg").src=document.getElementById("file1").value;唉,看看规范吧