search
HomeWeb Front-endJS TutorialJavascript solution to unknown runtime error when setting innerHTML under IE_javascript tips

Copy code The code is as follows:

<script> <BR>document.getElementById("trone") .innerHTML = "<td>haha"; <BR></script>



In IE, "unknown runtime error (unknown runtime error)" sometimes occurs, but not in Firefox.

This is mainly because when IE writes innerHTML, it will check whether the element has the requirements to be used as an html object container in these contents. For example, if you add html containing
  • to a p Code, this is going to go wrong. So if you find these errors appearing, try to do two things:
    1. Check whether the html code you try to add to innerHTML contains broken html tags, such as no
      surrounded by
    • .
      2. Change your container to a more "inclusive" tag, such as ,

      Special attention should be paid to the fact that adding the correctly formatted tag inside the , , tags may cause errors, so you should avoid using these tags as containers. You can use use document.getElementById("trone").innerHTML="new"; there will be no problem.
      As a solution, you can use javascript to dynamically create tags such as

      So, if it is
      instead of changing them directly using innerHTML.
      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
      如何解决C++运行时错误:'invalid memory access'?如何解决C++运行时错误:'invalid memory access'?Aug 27, 2023 am 10:15 AM

      如何解决C++运行时错误:'invalidmemoryaccess'?在C++编程中,当我们运行程序时,经常会遇到各种错误。其中一个常见的错误是'invalidmemoryaccess',即无效内存访问。这种错误通常出现在指针操作时,当我们访问了一个无效的内存地址时,程序就会崩溃并报出这个错误。这篇文章将介绍如何解决这种C++运行时错误,并给出一些代

      如何解决C++运行时错误:'invalid argument'?如何解决C++运行时错误:'invalid argument'?Aug 27, 2023 pm 01:54 PM

      如何解决C++运行时错误:'invalidargument'?在使用C++编写程序时,我们经常会遇到各种各样的错误。其中一个常见的错误是运行时错误:'invalidargument'。这个错误通常意味着我们传递给函数或方法的一个参数不符合预期,导致程序无法执行正确的操作。那么,当我们遇到这个错误时,应该如何解决呢?下面我们将通过代码示例来说明。首先,让我

      如何解决C++运行时错误:'stack overflow'?如何解决C++运行时错误:'stack overflow'?Aug 25, 2023 pm 10:00 PM

      如何解决C++运行时错误:'stackoverflow'在C++程序中,当递归层数过深或者程序使用的内存超出栈的容量会导致运行时错误"stackoverflow"。这种错误发生时,程序会崩溃,并且很难找出具体的原因。本文将介绍一些解决'stackoverflow'错误的方法,并提供一些代码示例。运行时错误"stackoverflow"的主要原因是栈内

      如何解决C++运行时错误:'invalid type conversion'?如何解决C++运行时错误:'invalid type conversion'?Aug 27, 2023 pm 03:33 PM

      如何解决C++运行时错误:'invalidtypeconversion'?在C++编程过程中,我们经常会遇到各种编译时和运行时错误。其中一个常见的运行时错误是'invalidtypeconversion'(无效的类型转换)错误。当我们把一个数据类型转换为另一个不兼容的数据类型时,就会触发此错误。本文将介绍一些常见的造成此错误的原因,以及如何解决这个错

      如何解决C++运行时错误:'divide by zero'?如何解决C++运行时错误:'divide by zero'?Aug 27, 2023 am 11:46 AM

      如何解决C++运行时错误:'dividebyzero'?在C++编程中,当我们尝试将一个数除以零时,运行时错误'dividebyzero'就会出现。这是因为在数学上,不允许将一个数除以零。因此,在程序中出现这个错误是非常常见的,但我们可以采取一些措施来解决它。解决这个问题的关键是避免将一个数除以零,我们可以借助条件语句、异常处理和其他技术来实现。下面

      如何解决C++运行时错误:'divide by zero exception'?如何解决C++运行时错误:'divide by zero exception'?Aug 25, 2023 pm 06:15 PM

      如何解决C++运行时错误:'dividebyzeroexception'?在C++编程中,当我们尝试将一个数除以零时,就会引发一个“dividebyzeroexception”的运行时错误。这种错误导致程序崩溃,并给我们带来很多麻烦。但是,幸运的是,我们可以采取一些措施来解决这个问题。在本文中,我们将探讨如何处理这个异常,并给出一些代码示例帮助你

      如何解决C++运行时错误:'file read/write error'?如何解决C++运行时错误:'file read/write error'?Aug 26, 2023 am 08:58 AM

      如何解决C++运行时错误:'fileread/writeerror'?在C++编程过程中,经常会遇到文件读写错误的问题,其中最常见的错误之一是'fileread/writeerror'。这种错误通常会导致程序的运行中断,给开发人员带来一定的困扰。本文将介绍这种错误产生的原因,并提供一些解决方法。首先,我们需要理解'fileread/writeer

      如何解决C++运行时错误:'division by zero'?如何解决C++运行时错误:'division by zero'?Aug 26, 2023 pm 11:37 PM

      如何解决C++运行时错误:'divisionbyzero'?引言:在C++编程过程中,我们可能会遇到一些运行时错误,如“divisionbyzero”(除以零)。这是一种常见的错误,但也是相对容易解决的问题。本文将向您介绍如何识别和解决这种类型的错误。错误原因的分析:在C++中,当我们对一个数字除以零时,将会引发“divisionbyzero”错

      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
      4 weeks 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

      Notepad++7.3.1

      Notepad++7.3.1

      Easy-to-use and free code editor

      SecLists

      SecLists

      SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

      ZendStudio 13.5.1 Mac

      ZendStudio 13.5.1 Mac

      Powerful PHP integrated development environment

      EditPlus Chinese cracked version

      EditPlus Chinese cracked version

      Small size, syntax highlighting, does not support code prompt function