How to print out line in Javascript -
i want test return value of function getfileextension(input.files[0].name) (i have comment there point @ line) question how print out value in javascript? thanks!
<script> function getfileextension(filename) { var ext=filename.split('.').pop(); return ext } </script> <input type='file' onchange="readurl(this);"> <script> function readurl(input) { if (input.files && input.files[0]) { if (getfileextension(input.files[0].name)=="png") { // line our problem var reader = new filereader(); reader.onload = function (e) { document.getelementbyid("pdf").innerhtml="<img id='blah' src=" + e.target.result + " alt='your image' width='450'>" } reader.readasdataurl(input.files[0]); } } } </script>
you can print out values in javascript writing
console.log(value);
most browsers have console can see pressing f12
. values end there.
if using internet explorer remember have developer tools open (f12) or error.
Comments
Post a Comment