您的位置:首页 > Web前端 > JavaScript

ie7下javascript中获取input type=file中的内容

2010-11-11 11:57 381 查看
var file1= document.getElementById("file1").value;

// 判断浏览器类型,防止浏览器将文件路径设为C:/fakepath/
var isIE = (document.all) ? true : false;
var isIE7 = isIE && (navigator.userAgent.indexOf('MSIE 7.0') != -1);
var isIE8 = isIE && (navigator.userAgent.indexOf('MSIE 8.0') != -1);
if(isIE7 || isIE8)
{
var file = document.getElementById("file1");
file.select();
file1= document.selection.createRange().text;
document.selection.empty();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: