js脚本实现上传图片无刷新预览!

< html xmlns ="http://www.w3.org/1999/xhtml" >
< head runat ="server" >
< script type ="text/javascript" > ...
functionchangeimg(imgid,fileid)
...{
document.getElementById(imgid).src
=document.getElementById(fileid).value;
}

</ script >
< title > 无标题页 </ title >
</ head >
< body >
< form id ="form1" runat ="server" >
< img src ="" style ="width:117px;height:63px" id ="image1" />
< input id ="File2" type ="file" runat ="server" onchange ="changeimg('image1','File2')" />
</ form >
</ body >
</ html >

效果如图:

你可能感兴趣的:(JavaScript,html,XHTML,脚本)