From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- .../hu/web/api/document/createtextnode/index.html | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 files/hu/web/api/document/createtextnode/index.html (limited to 'files/hu/web/api/document/createtextnode/index.html') diff --git a/files/hu/web/api/document/createtextnode/index.html b/files/hu/web/api/document/createtextnode/index.html new file mode 100644 index 0000000000..6fc2489f34 --- /dev/null +++ b/files/hu/web/api/document/createtextnode/index.html @@ -0,0 +1,82 @@ +--- +title: Document.createTextNode() +slug: Web/API/Document/createTextNode +tags: + - API + - DOM + - Document + - Method + - Reference + - Szöveg + - creatTextNode +translation_of: Web/API/Document/createTextNode +--- +
{{APIRef("DOM")}}
+ +

Készít egy új {{domxref("Text")}} node-ot. Ezt a metódust használhatod arra hogy escape-eld a HTML karaktereket a szövegből, mint pl "<" vagy "&"

+ +

Syntax

+ +
var textNode = document.createTextNode(text);
+
+ + + +

Példa

+ +
<!DOCTYPE html>
+<html lang="en">
+<head>
+<title>createTextNode example</title>
+<script>
+function addTextNode(text) {
+  var newtext = document.createTextNode(text),
+      p1 = document.getElementById("p1");
+
+  p1.appendChild(newtext);
+}
+</script>
+</head>
+
+<body>
+  <button onclick="addTextNode('IGEN! ');">IGEN!</button>
+  <button onclick="addTextNode('NEM! ');">NEM!</button>
+  <button onclick="addTextNode('ESCAPE <strong>BOLD</strong> AND &bull; ENTITIES! ');">ESCAPE <strong>BOLD</strong> AND &bull; ENTITIES!</button>
+
+  <hr />
+
+  <p id="p1">First line of paragraph.</p>
+</body>
+</html>
+
+
+ +

{{EmbedLiveSample('Example')}}

+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('DOM WHATWG', '#dom-document-createtextnode', 'Document: createTextNode')}}{{Spec2('DOM WHATWG')}}
+ +

Browser compatibility

+ + + +

{{Compat("api.Document.createTextNode")}}

-- cgit v1.2.3-54-g00ecf