来源:http://hi.baidu.com/ypxmaomao/blog/item/83dee50a800ef91694ca6b51.html
第一步:打开“about:config”页面,查找“signed.applets.codebase_principal_support”属性,将其值设置为true。
设为TRUE
第二步:在javascript中采用以下代码进行获取:
复制内容到剪贴板
代码:
<script >
function getValueFF(id){
var ip = document.getElementById(id);
if (ip.files) {
//ffx3 - try to have access to full path
try {
netscape.security.PrivilegeManager.enablePrivilege( 'UniversalFileRead' )
}
catch (err) {
//need to set signed.applets.codebase_principal_support to true
}
};
return ip.value;
}
function show(){
alert(getValueFF("file1"))
}
</script>
<input id="file1" type="file" onChange="show()">
function getValueFF(id){
var ip = document.getElementById(id);
if (ip.files) {
//ffx3 - try to have access to full path
try {
netscape.security.PrivilegeManager.enablePrivilege( 'UniversalFileRead' )
}
catch (err) {
//need to set signed.applets.codebase_principal_support to true
}
};
return ip.value;
}
function show(){
alert(getValueFF("file1"))
}
</script>
<input id="file1" type="file" onChange="show()">
经过以上步骤,在Firefox3下获取file input的value时,会弹出一个警告窗口,点确定即可。