search
HomeWeb Front-endJS TutorialRead-only innerHTML_javascript technique under IE

I encountered a problem while working on something today. I tried to dynamically add multiple rows of data to a table. I first defined a table:

Copy code The code is as follows:








Then do this in JavaScript:
Copy code The code is as follows:

for(var i in entries){
...
var filetable = document.getElementById('filelist');
filetable.innerHTML = ' 111 222 ';
}

This is how you do it in FireFox There is no problem, but it will not work if I put it under IE. I asked my colleagues to search and found that COL, COLGROUP, FRAMESET, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR are the elements of COL, COLGROUP, FRAMESET, HTML, TFOOT, THEAD, TITLE, TR under IE. The innerHTML properties are read-only and cannot be manipulated directly. But there is no solution. TD’s innerHTML can still be operated. The above code can be modified like this:
Copy the code The code is as follows :

for(var i in entries){
...
var filetable = document.getElementById('filelist');
var tr = document.createElement(' tr');
var td1 = document.createElement('td');
td1.innerHTML = '111';
var td2 = document.createElement('td');
td2. innerHTML = '222';
tr.appendChild(td1);
tr.appendChild(td2);
filetable.appendChild(tr);
}

Yes First use the createElement method of DOM to create tr and td, then perform corresponding operations on the innerHTML of td, and finally use the appendChild method to add the created elements to the DOM tree. This way it can run normally under IE. It should be noted that if your table does not have a tbody, but looks like this:

At this time, you cannot use the appendChild method directly on the table, because The table element under IE6 does not support the appendChild method (IE8 seems to already support it).
Some people on the Internet have also proposed to use methods such as insertRow() to do it, but this method is also problematic in compatibility with different browsers (you need to use insertRow(-1) under FireFox), so it is useless.
BTW, although I have consciously read a lot of JS information before, I still learned the truth through practice. Now I am just in a hurry, so I am learning to be calm.
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Internet Explorer 打开 Edge:如何停止 MS Edge 重定向Internet Explorer 打开 Edge:如何停止 MS Edge 重定向Apr 14, 2023 pm 06:13 PM

长期以来,InternetExplorer的失宠一直不是秘密,但随着Windows11的到来,现实开始了。Edge将来不再有时取代IE,它现在是微软最新操作系统中的默认浏览器。目前,您仍然可以在Windows11中启用InternetExplorer。但是,IE11(最新版本)已经有了一个正式的退役日期,即2022年6月15日,时间在流逝。考虑到这一点,您可能已经注意到InternetExplorer有时会打开Edge,而您可能不喜欢它。那么为什么会这样呢?在

win11无法使用ie11浏览器怎么办?(win11用不了ie浏览器)win11无法使用ie11浏览器怎么办?(win11用不了ie浏览器)Feb 10, 2024 am 10:30 AM

越来越多的用户开始升级win11系统,由于每个用户的使用习惯不同,还是有不少用户在使用ie11浏览器,那么win11系统用不了ie浏览器,该怎么办呢?windows11还支持ie11吗?下面就来看看解决办法。win11无法使用ie11浏览器的解决方法1、首先右键开始菜单,选择“命令提示符(管理员)”打开。2、打开之后,直接输入“Netshwinsockreset”,回车确定。3、确定之后再输入“netshadvfirewallreset&rdqu

Win10打开IE自动跳转到Edge怎么取消_IE浏览器页面自动跳转的解决办法Win10打开IE自动跳转到Edge怎么取消_IE浏览器页面自动跳转的解决办法Mar 20, 2024 pm 09:21 PM

近期不少的win10用户们在使用电脑浏览器的时候发现自己的ie浏览器总是自动的跳转到edge浏览器,那么win10打开ie自动跳转edge怎么关闭?。下面就让本站来为用户们来仔细的介绍一下win10打开ie自动跳转edge关闭方法吧。1、我们登录edge浏览器,点击右上角...,找下拉的设置选项。2、我们进入设置后,在左侧栏点击默认浏览器。3、最后我们在兼容性中,勾选不允许IE模式下重新加载网站,重启ie浏览器即可。

一个时代的结束:Internet Explorer 11 已退役,这是你需要知道的一个时代的结束:Internet Explorer 11 已退役,这是你需要知道的Apr 20, 2023 pm 06:52 PM

2022年6月15日是Microsoft结束对InternetExplorer11(IE11)的支持并关闭其旧版浏览器章节的日子。一段时间以来,该公司一直在提醒用户注意这一生命周期结束日期,并呼吁他们计划迁移到MicrosoftEdge。Microsoft将IE11与Windows8.1捆绑在一起,作为Windows的现代默认Web浏览器。尽管它从未达到Chrome的(当前)高度,但它是2014年使用量第二大的桌面浏览器,仅次于IE8。当然,随着20

ie快捷方式无法删除如何解决ie快捷方式无法删除如何解决Jan 29, 2024 pm 04:48 PM

ie快捷方式无法删除的解决办法:​1、权限问题;2、快捷方式损坏;3、软件冲突;4、注册表问题;5、恶意软件;6、系统问题;7、重新安装IE;8、使用第三方工具;9、检查快捷方式的目标路径;10、考虑其他因素;11、咨询专业人士。详细介绍:​1、权限问题,右键点击快捷方式,选择“属性”,在“安全”选项卡中,确保有足够的权限删除该快捷方式,如果没有,可以尝试以管理员身份运行等等。

如何启用IE的加速功能如何启用IE的加速功能Jan 30, 2024 am 08:48 AM

ie加速功能怎么开?ie打开网页的速度太慢,我们可以在里面开启硬件加速模式。很多小伙伴反应说在使用ie浏览器的时候,打开网页的速度特别的慢,这样对我们浏览网页也造成了一定影响。就想询问小编有什么解决办法,这种情况是可以开启ie浏览器的硬件加速模式,小编下面整理了ie开启加速功能方法,感兴趣的话一起往下看看!ie开启加速功能方法打开IE安全浏览器,点击右上角齿轮状的“设置”图标,选择“Internet选项”进入,如图所示。2、在Internet选项的窗口头部的标签导航中点击“高级”,如图所示。3、

win10家庭版IE浏览器突然打不开了win10家庭版IE浏览器突然打不开了Jan 18, 2024 pm 02:57 PM

或许有部分朋友日常工作或因个人需求而深谙于使用InternetExplorer(IE)浏览器。然而,在Windows系统版本升级至Windows10之后,他们可能会不期然遭遇IE无法正常运行之烦扰。在此种情况下,可以尝试依据Microsoft官方网站所提供的"帮助与支持中心"中的解决方案,来设法排除此问题。win10家庭版IE浏览器突然打不开了1、打开Internet选项,然后切换到连接2、再点击下面的局域网设置3、然后把这里的选项都取消勾选4、然后以管理员身份运行cmd,再输入netsh回车5

win10系统ie主页被锁定处理方法win10系统ie主页被锁定处理方法Mar 28, 2024 pm 01:10 PM

1、右键【开始】,打开【程序和功能】;如图所示:2、点击【启用或关闭Windows功能】;如图所示:3、去掉【InternetExplorer11】前面的勾;如图所示:4、点击【是】;如图所示:5、重启电脑。6、然后按之前的过程再把【InternetExplorer11】勾选上,再重启电脑即可。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools