简体   繁体   English

Internet Explorer 8:jQuery加载问题?

[英]Internet Explorer 8: jQuery load issue?

I recently found out about a program, IETester, to test my website http://www.gfcf14greendream.com/ on the different versions of internet explorer. 我最近发现了一个名为IETester的程序,可以在不同版本的Internet Explorer上测试我的网站http://www.gfcf14greendream.com/ While on chrome and firefox, my site looks like this: 在chrome和firefox上时,我的网站如下所示:

在此处输入图片说明

But when I open my web site on IE8, I get this error: 但是,当我在IE8上打开网站时,出现此错误:

在此处输入图片说明

The line for the greedream.js file is: document.getElementById("log").innerHTML = data; greedream.js文件的行是:document.getElementById(“ log”)。innerHTML = data; from the function: 从函数:

function loadLog() {
    $.get("/PHP/loadlog.php", function(data) {
        document.getElementById("log").innerHTML = data;
    });
}

which loads the text file with the info that you see on the text area to the right, the "site log". 它将使用在右侧文本区域(“站点日志”)中看到的信息加载文本文件。 This site log then appears but without any words in it. 然后出现该站点日志,但其中没有任何文字。 Is it that jQuery doesn't work for internet explorer 8 (and consequently any lower versions)? 是jQuery不适用于Internet Explorer 8(因此没有任何较低版本)吗? Thank you for any help in advance. 感谢您的任何帮助。

Your problem might be caused by the following html element: 您的问题可能是由以下html元素引起的:

<object width="90%" height="600" 
  data="http://www.gfcf14greendream.com/thesitelog.html" type="text/html"></object>

Later the the $("#log") does not return an element in IE. 稍后$("#log")不会在IE中返回元素。

You might consider inlining the code in thesitelog.html so you can find the element with the id log. 您可以考虑内联thesitelog.html中的代码,以便找到具有id日志的元素。

Not sure if this will work but every time you set an object with data property the greendream.js is loaded again. 不知道这是否行得通,但是每次您使用数据属性设置对象时,都会再次加载greendream.js。 Maybe when it's loaded from thesitelog.html it can access the Element with the id of 'log': 也许从thesitelog.html加载时,它可以访问id为'log'的Element:

function loadLog() {
  if(/thesitelog.html$/i.test(window.location)===true){
    $.get("/PHP/loadlog.php", function(data) {
      $('#log').html(data);
    });
  }
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM