node.innerHTML ='...'在IE中不起作用 [英] node.innerHTML = '...' not working in IE

查看:66
本文介绍了node.innerHTML ='...'在IE中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个荒谬的问题,试图设置一个

div节点的innerHTML。它适用于所有其他浏览器,但Internet Explorer是

给我一个未知的运行时错误。这实际上是在开发自动建议的背景下(基本上是逆向工程Google

建议),但是我看不出其他代码是怎么回事有事可做

吧。我非常确定*我已经将它缩小到1行(

行,其中抛出了javascript错误。以下是

行's抛出javascript错误:


[----------------------------- ------------------------


document.getElementById(''suggest_box'')。innerHTML = listings ;


------------------------------------- ----------------]


其中listing是使用XmlHttpRequest对象获取的html代码

a远程PHP文件。我做了一个警报(列表)和一个

" alert(document.getElementById(''suggest_box'')。inne rHTML)就在
错误行,果然,列表显示它确实设置了

,并且suggest_box节点确实存在。我的大脑被炒了

从试图弄清​​楚这件事。我会喜欢任何人对此有任何建议/评论谢谢!

解决方案

Joel Byrd于2005年11月17日在comp.lang.javascript中写道

我有这个荒谬的问题,试图设置一个
div节点的innerHTML。它适用于所有其他浏览器,但Internet Explorer正在给我一个未知的运行时错误。这实际上是在开发自动建议(基本上是逆向工程Google
建议)的背景下,但我不知道其他任何代码有什么可做的事情
用它。我非常确定*我已经将它缩小到1行(
行引发了javascript错误。以下是
引发javascript错误的行:

[----------------------------------------- ------------

document.getElementById(''suggest_box'')。innerHTML = listing;

------- ----------------------------------------------]

其中listing是使用远程PHP文件上的XmlHttpRequest对象获取的html代码。我执行alert(listing)和
alert(文档) .getElementById(''suggest_box'')。inne rHTML)在错误行之前,当然,列表显示它确实设置了,并且suggest_box节点确实存在。我的试图把这件事弄清楚,脑子已经油腻了。我会喜欢任何有关此事的建议/评论。谢谢!




也许"选不是字符串而是对象吗?


你可以尝试:


document.getElementById(''suggest_box'')。innerHTML =''''+上市;

-

Evertjan。

荷兰。

(全部替换在我的电子邮件中穿过圆点)


不,我实际上已经尝试过了。


Evertjan。写道:

Joel Byrd于2005年11月17日在comp.lang.javascript写了

我有这个荒谬的问题试图设置一个
div节点的innerHTML。它适用于所有其他浏览器,但Internet Explorer正在给我一个未知的运行时错误。这实际上是在开发自动建议(基本上是逆向工程Google
建议)的背景下,但我不知道其他任何代码有什么可做的事情
用它。我非常确定*我已经将它缩小到1行(
行引发了javascript错误。以下是
引发javascript错误的行:

[----------------------------------------- ------------

document.getElementById(''suggest_box'')。innerHTML = listing;

------- ----------------------------------------------]

其中listing是使用远程PHP文件上的XmlHttpRequest对象获取的html代码。我执行alert(listing)和
alert(文档) .getElementById(''suggest_box'')。inne rHTML)在错误行之前,当然,列表显示它确实设置了,并且suggest_box节点确实存在。我的试图解决这个问题,大脑已经被炒了。我会喜欢任何有关此事的建议/评论。谢谢!



也许是列表你不是一个字符串而是一个对象吗?

你可以尝试:

document.getElementById(''suggest_box'')。innerHTML =''''+ listing;

-
Evertjan。
荷兰。
(用我的电子邮件中的点替换所有十字架)






Joel Byrd写道:

我有这个荒谬的问题,试图设置一个
div节点的innerHTML。它适用于所有其他浏览器,但Internet Explorer正在给我一个未知的运行时错误。这实际上是在开发自动建议(基本上是逆向工程Google
建议)的背景下,但我不知道其他任何代码有什么可做的事情
用它。我非常确定*我已经将它缩小到1行(
行引发了javascript错误。以下是
引发javascript错误的行:

[----------------------------------------- ------------

document.getElementById(''suggest_box'')。innerHTML = listing;

------- ----------------------------------------------]

其中listing是使用远程PHP文件上的XmlHttpRequest对象获取的html代码。我执行alert(listing)和
alert(文档) .getElementById(''suggest_box'')。inne rHTML)在错误行之前,当然,列表显示它确实设置了,并且suggest_box节点确实存在。我的试图把这个东西搞砸了,大脑已经被炒了。我会喜欢任何有关此事的建议/评论。谢谢!




By任何机会 - 也许吧你的列表包含表格的HTML代码?


I am having this ridiculous problem of trying to set the innerHTML of a
div node. It works in all other browsers, but internet explorer is
giving me an "Unknown runtime error". This is actually in the context
of developing an auto-suggest (basically reverse-engineering Google
Suggest), but I don''t see how any of the other code has anything to do
with it. I *pretty sure* that I''ve narrowed it down to 1 line (the
line on which the javascript error is being thrown. The following is
the line that''s throwing the javascript error:

[-----------------------------------------------------

document.getElementById(''suggest_box'').innerHTML = listings;

-----------------------------------------------------]

where "listings" is html code gotten using the XmlHttpRequest object on
a remote PHP file. I do an "alert(listings)" and a
"alert(document.getElementById(''suggest_box'').inne rHTML)" right before
the error line and sure enough, the listings is showing that it is
indeed set, and the suggest_box node indeed exists. My brain is fried
from trying to figure this thing out. I would love any
suggestions/comments anybody has about this. Thanks!

解决方案

Joel Byrd wrote on 17 nov 2005 in comp.lang.javascript:

I am having this ridiculous problem of trying to set the innerHTML of a
div node. It works in all other browsers, but internet explorer is
giving me an "Unknown runtime error". This is actually in the context
of developing an auto-suggest (basically reverse-engineering Google
Suggest), but I don''t see how any of the other code has anything to do
with it. I *pretty sure* that I''ve narrowed it down to 1 line (the
line on which the javascript error is being thrown. The following is
the line that''s throwing the javascript error:

[-----------------------------------------------------

document.getElementById(''suggest_box'').innerHTML = listings;

-----------------------------------------------------]

where "listings" is html code gotten using the XmlHttpRequest object on
a remote PHP file. I do an "alert(listings)" and a
"alert(document.getElementById(''suggest_box'').inne rHTML)" right before
the error line and sure enough, the listings is showing that it is
indeed set, and the suggest_box node indeed exists. My brain is fried
from trying to figure this thing out. I would love any
suggestions/comments anybody has about this. Thanks!



perhaps "listings" is not a string but an object?

Could you try:

document.getElementById(''suggest_box'').innerHTML = '''' + listings;
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


No, I''ve actually tried that.

Evertjan. wrote:

Joel Byrd wrote on 17 nov 2005 in comp.lang.javascript:

I am having this ridiculous problem of trying to set the innerHTML of a
div node. It works in all other browsers, but internet explorer is
giving me an "Unknown runtime error". This is actually in the context
of developing an auto-suggest (basically reverse-engineering Google
Suggest), but I don''t see how any of the other code has anything to do
with it. I *pretty sure* that I''ve narrowed it down to 1 line (the
line on which the javascript error is being thrown. The following is
the line that''s throwing the javascript error:

[-----------------------------------------------------

document.getElementById(''suggest_box'').innerHTML = listings;

-----------------------------------------------------]

where "listings" is html code gotten using the XmlHttpRequest object on
a remote PHP file. I do an "alert(listings)" and a
"alert(document.getElementById(''suggest_box'').inne rHTML)" right before
the error line and sure enough, the listings is showing that it is
indeed set, and the suggest_box node indeed exists. My brain is fried
from trying to figure this thing out. I would love any
suggestions/comments anybody has about this. Thanks!



perhaps "listings" is not a string but an object?

Could you try:

document.getElementById(''suggest_box'').innerHTML = '''' + listings;
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)





Joel Byrd wrote:

I am having this ridiculous problem of trying to set the innerHTML of a
div node. It works in all other browsers, but internet explorer is
giving me an "Unknown runtime error". This is actually in the context
of developing an auto-suggest (basically reverse-engineering Google
Suggest), but I don''t see how any of the other code has anything to do
with it. I *pretty sure* that I''ve narrowed it down to 1 line (the
line on which the javascript error is being thrown. The following is
the line that''s throwing the javascript error:

[-----------------------------------------------------

document.getElementById(''suggest_box'').innerHTML = listings;

-----------------------------------------------------]

where "listings" is html code gotten using the XmlHttpRequest object on
a remote PHP file. I do an "alert(listings)" and a
"alert(document.getElementById(''suggest_box'').inne rHTML)" right before
the error line and sure enough, the listings is showing that it is
indeed set, and the suggest_box node indeed exists. My brain is fried
from trying to figure this thing out. I would love any
suggestions/comments anybody has about this. Thanks!



By any chance - maybe your "listings" contains HTML code for a table?


这篇关于node.innerHTML ='...'在IE中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆