Skip to content

Instantly share code, notes, and snippets.

@yardfarmer
Created September 13, 2014 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yardfarmer/fd84affff7ef347bf68f to your computer and use it in GitHub Desktop.
Save yardfarmer/fd84affff7ef347bf68f to your computer and use it in GitHub Desktop.
<!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