gpt4 book ai didi

javascript - Netscape 7.0+ 设置 HTML DOM 节点文本 (ECMAScript 3)

转载 作者:行者123 更新时间:2023-11-29 19:23:19 26 4
gpt4 key购买 nike

我正在尝试在 Netscape 7.0 上设置元素的内部文本我试过了

var element = document.getElementById('element');
element.textContent = 'working1';
element.innerText = 'working2';

这适用于所有当前的浏览器 IE8+、FF、Chrome、opera、Microsoft Edge、Safari


历史

发件人:https://www.w3.org/community/webed/wiki/A_Short_History_of_JavaScript

The standards process continued in cycles, with releases of ECMAScript 2 in 1998 and ECMAScript 3 in 1999, which is the baseline for modern day JavaScript. The "JS2" or "original ES4" work led by Waldemar Horwat (then of Netscape, now at Google) started in 2000 and at first, Microsoft seemed to participate and even implemented some of the proposals in their JScript.net language.

根据:https://en.wikipedia.org/wiki/Netscape_(web_browser)

Netscape 7.0 was released on August 29, 2002

根据:https://en.wikipedia.org/wiki/ECMAScript

ECMAScript 3 was released on December 1999

ECMAScript 3 specification

最佳答案

Netscape 不支持

.innerText。使用.innerHTML 代替。

如果你需要担心转义,你可以这样做:

  element.appendChild(document.createTextNode("whatever"));

关于javascript - Netscape 7.0+ 设置 HTML DOM 节点文本 (ECMAScript 3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32103145/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com