Latest web development tutorials

Metoda HTML DOM createComment ()

Document Object Reference Document Object

Przykłady

Można utworzyć węzeł komentarz, a do dokumentu HTML:

var c=document.createComment("My personal comments");
document.body.appendChild(c);

wyjście:

<!--My personal comments-->

Spróbuj »

Definicja i Wykorzystanie

Metoda createComment (), aby utworzyć węzeł komentarz.


Pomoc Browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Metoda Wszystkie główne przeglądarki obsługują createComment ()


gramatyka

document.createComment(text)

parametry

参数 类型 描述
text String 可选. 添加的注释文本。

Wartość zwracana

类型 描述
Comment object 创建的注释节点

dane techniczne

wersja DOM Rdzeń Poziom 1 Document Object


Document Object Reference Document Object