<input id="file" type="file" name="file" size="35" onchange="getDataF(this)"/>
<script type="text/javascript" src="jquery.js"></script>
<script lang="text/javascript" src="xlsx.full.min.js"></script>
<!--引入文件下载至本地 xlsx.full.min.js(https://github.com/SheetJS/sheetjs)-->
<SCRIPT LANGUAGE="javascript">
function getDataF(obj){
var wb;
var aa=[];
var text=[];
var rABS = false;
if(!obj.files) {
return;
}
const IMPORTFILE_MAXSIZE = 1*2048;
var suffix = obj.files[0].name.split(".")[1];
if(suffix != 'xls' && suffix !='xlsx'){
alert('导入的文件格式不正确!');
return
}
if(obj.files[0].size/1024 > IMPORTFILE_MAXSIZE){
alert('导入的表格文件不能大于2M');
return
}
var f = obj.files[0];
var reader = new FileReader();
reader.onload = function(e) {
var data = e.target.result;
if(rABS) {
wb = XLSX.read(btoa(fixdata(data)), {
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
}
aa = JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) );
var u = eval('('+aa+')');
getData= JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) );
for(var i=0;i<u.length;i++){
text.push(u[i].address);
}
};
if(rABS) {
reader.readAsArrayBuffer(f);
} else {
reader.readAsBinaryString(f);
}
}
</script>
<script language="JScript" runat="Server">
function toObject(json) {
eval("var o=" + json);
return o;
}
function toArray(s){
var dic = Server.CreateObject("Scripting.Dictionary")
eval("var a=" + json);
for(var i=0;i<a.length;i++){
var obj = Server.CreateObject("Scripting.Dictionary")
for(x in a[i]) obj.Add(x,a[i][x])
dic.Add(i, obj);
}
return dic
}
</script>
<%
Dim json
json ="[{
Set json = toArray(json)
For i=0 To json.Count-1
Response.Write json(i)("uid") & " <br/>"
Response.Write json(i)("username") & " <br/>"
Response.Write json(i)("email") & " <br/>"
Next
Set json = Nothing
%>