Html
Java 2016
//Input image
<input type="file" accept="image/*" onchange="loadFile(event)"> //Input image
//Output image
<img id="output"/>
Or Javascript - 1
Java 2016
<script> var loadFile = function(event) { var output = document.getElementById('output'); output.src = URL.createObjectURL(event.target.files[0]); }; </script>
Or Javascript - 2
Java 2016
> Run demo<script> var loadFile = function(event) { var reader = new FileReader(); reader.onload = function(){ var output = document.getElementById('output'); output.src = reader.result; }; reader.readAsDataURL(event.target.files[0]); }; </script>
0 nhận xét:
Post a Comment