<html>
<head></head>
<body>
<div>
<img id="imgShow" style="width:250px;height:250px">
<div>
<input value="预览" type="file" id="imgFile">
<script>
document.getElementById('imgFile').onchange = function(e){
var ele = document.getElementById('imgFile').files[0];
var createObjectURL = function(blob){
return window[window.webkitURL ? 'webkitURL' : 'URL']['createObjectURL'](blob);
};
var newimgdata = createObjectURL(ele);
document.getElementById('imgShow').src = newimgdata
}
</script>
</body>
</html>