jQuery innerHTML无法设置属性

时间:2017-09-16 19:32:39

标签: innerhtml

我有<div id="tguide">我用作占位符。我被告知iframe不如jquery负载。所以这就是我所拥有的:

``$(window).on('load resize',function(e){

var transferguidelocation = "../"
    var title = $(document).attr('title');
    if(title == 'System Manuals') {
        var transferguidelocation = "../SystemManuals/"
    };
document.getElementById("tguide").innerHTML='<object type="text/html" data="' + transferguidelocation + 'shared/TransferGuide.html" style="width:100%;height:100%;"></object>'; 

您可以先查看它所在的页面,然后在TransferGuide.html位置添加额外的文件夹位置。

该文件加载到<div>没有问题,它看起来就像我想要的那样,数据是正确的,问题是我在浏览器检查器中收到以下错误:

enter image description here

这有点烦人,我不是错误的粉丝。有谁知道我怎么能摆脱这个?

1 个答案:

答案 0 :(得分:0)

我明白了。我在js.min文件之前引用了我的custom.js文件,因此它无法识别它。我只是颠倒了两个,错误就消失了

相关问题