gpt4 book ai didi

javascript - GetElementByID 在 IE 中失败,在 Chrome 和 FF 中有效

转载 作者:行者123 更新时间:2023-11-28 20:24:52 26 4
gpt4 key购买 nike

我查了又查,但找不到解决这个问题的方法。我有一个表单,将几个值返回到变量 _ 和 _ 中。我使用这些值通过“setfilenameinbox”函数更新其他表单值。这在 Chrome 和 Firefox 中都可以正常工作,但在我测试过的所有 IE 版本(7 和 8)中,该值并未更新。

非常希望知道为什么代码在 IE 中不起作用。

<script type="text/javascript">

function setfilenameinbox(uploadname, url){
document.getElementById("textboxFileName").value = uploadname;
document.getElementById("FPFileURL").value = url;
}

function openFilePicker(){

filepicker.setKey('***edited out for help***');

filepicker.pick({
extensions: ['.pdf', '.jpg'],
container: 'window',
services:['COMPUTER', 'DROPBOX', 'GOOGLE_DRIVE'],
},
function(FPFile){
console.log(JSON.stringify(FPFile));

//upload complete
setfilenameinbox(FPFile.filename, FPFile.url);
},
function(FPError){
console.log(FPError.toString());
}
);
}
</script>

最佳答案

我认为 IE7 和 8 没有 console 对象(除非某些库或插件为其提供了一个)。 console.log 应该会破坏 < IE8 中的代码。我建议您删除生产中的console命令。

关于javascript - GetElementByID 在 IE 中失败,在 Chrome 和 FF 中有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17576295/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com