<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>
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>
以后请用标准的代码来写,总共不过多打10几个字母罢了. 以后别这么写就行了,没什么好郁闷的.
<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,火狐,网景都测试过完全正常
改为:
document.getElementById("imgg").src=document.getElementById("file1").value;唉,看看规范吧