js 上传图片预览

复制代码
 <script language='javascript'>   
  function   show(){   
  var p=document.getElementById("file1").value;
  document.getElementById("s").innerHTML="<input type=image id=pic width=150 height=100 /> ";   
  document.getElementById("pic").src=p;
  //alert(p);    
  }   
  </script>
复制代码

 

  <input type="file" name="file1" id="file1" onpropertychange="show();" />
  <span id="s"></span>

 

posted @ 2016-04-11 21:52  源哥来了  阅读(205)  评论(0编辑  收藏  举报