标签:plain elements round var change javascrip function tag keyword
<body>
<input type=
"file"
id=
"file"
name=
""
/>
<div id=
"image"
style=
"width:390px;height:280px; background:#CCCCCC; float:left;"
>
<img src=
"11.png"
/>
</div>
</body>
<script>
document.getElementById(
‘file‘
).onchange =
function
() {
var
imgFile =
this
.files[0];
var
fr =
new
FileReader();
fr.onload =
function
() {
document.getElementById(
‘image‘
).getElementsByTagName(
‘img‘
)[0].src = fr.result;
};
fr.readAsDataURL(imgFile);
};
</script>
标签:plain elements round var change javascrip function tag keyword
原文地址:https://www.cnblogs.com/cenfengtao/p/10040033.html