function handleFileSelect(evt) {
var files = evt.target.files// FileList object
// Loop through the FileList
for (var i = 0, ff = files[i]i++) {
var reader = new FileReader()
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
// Print the contents of the file
var span = document.createElement('span')
span.innerHTML = ['<p>',e.target.result,'</p>'].join('')
document.getElementById('list').insertBefore(span, null)
}
})(f)
// Read in the file
//reader.readAsDataText(f,UTF-8)
//reader.readAsDataURL(f)
reader.readAsText(f)
小项目使用jquery-2.0.0.min.js就可以了,这个是简化版本,假如在webroot目录下建立一个名为JS文件夹,在a.jsp中加入这样的语句就可以了<script type="text/javascript" language="javascript" src="./js/jquery-1.7.2.min.js" ></script>可以到http://download.csdn.net/download/siyupy_888/5552669下载jquery +ajax的源码实例欢迎分享,转载请注明来源:内存溢出
评论列表(0条)