原文链接:https://www.hebaocun.com/blog/21.html
JS:
$(function(){
$("#userFile").change(function(){
batchImportUser();
});
})
function batchImportUser(){
alert(1);
$("#userFile").replaceWith('<input style="opacity: 0;z-index:9999999;position: relative;left: -145px;" id="userFile" name="file" type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" value="导入用户" class="sureBtn sureBtnEx marginL20"/>');
$("#userFile").on("change", function(){
batchImportUser();
});
}
$("#userFile").replaceWith('<input style="opacity: 0;z-index:9999999;position: relative;left: -145px;" id="userFile" name="file" type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" value="导入用户" class="sureBtn sureBtnEx marginL20"/>');
$("#userFile").on("change", function(){
batchImportUser();
});
}
HTML:
<input style="opacity: 1;z-index:9999999;position: relative;left: -145px;" id="userFile" name="file" type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" value="导入用户" class="sureBtn sureBtnEx marginL20"/>
转载地址:http://blog.csdn.net/wc0077/article/details/42065193