Created
September 13, 2014 00:37
-
-
Save yardfarmer/fd84affff7ef347bf68f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> quick run !</title> | |
<script src=""></script> | |
</head> | |
<body> | |
选择 js 文件执行: | |
<input type='file' accept='.js' value='' /> | |
<script> | |
var fileHandler = document.querySelector('input[type="file"]'); | |
fileHandler.addEventListener('change',function(){ | |
console.log(this.files); | |
var file = this.files[0]; | |
var fileReader = new FileReader(); | |
var t = fileReader.readAsBinaryString(file); | |
fileReader.onloadend = function (){ | |
console.log(file,t,fileReader.result); | |
} | |
},false); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment