diff --git a/Functions.html b/Functions.html new file mode 100644 index 0000000..d4e1502 --- /dev/null +++ b/Functions.html @@ -0,0 +1,45 @@ + + + + + + + + + DOM Functions + + + +
+
+ +
+
+

Conversor de CSV para Table

+
+ +
+ +
+

Buscar Elementos

+
+ +
+
+ +
+

Substituir Imagens

+
+
Victor
+
Vincent
+
Vinicius

+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/Functions.js b/Functions.js new file mode 100644 index 0000000..11d0a87 --- /dev/null +++ b/Functions.js @@ -0,0 +1,51 @@ +function converter(){ + let table = document.createElement("table"); + let tablePosition = document.getElementById("tablePosition"); + + tablePosition.appendChild(table); + + let csv = document.getElementById("csv").value; + let lines = csv.split("\n"); + + for(var i = 0; i < lines.length; i++){ + let row = document.createElement("tr"); + let cells = lines[i].split(","); + + for(var j = 0; j < cells.length; j++){ + let col = document.createElement("td"); + row.appendChild(col); + + let value = document.createTextNode(cells[j]); + col.appendChild(value); + } + table.appendChild(row); + } +} + + +function search(node, tag, list){ + if(node.tagName == tag){ + list.push(node); + } + for(let i = 0; i < node.childNodes.length; i++){ + search(node.childNodes[i], tag, list); + } +} + +function tagByName(){ + let tag = document.getElementById("tag").value; + let list = []; + + search(document, tag, list); + return list; +} + + +function replace(){ + let imgs = document.getElementsByTagName("img"); + + for(var i = 0; i < imgs.length;){ + let parent = imgs[i].parentElement; + parent.replaceChild((document.createTextNode(imgs[i].alt)), imgs[i]) + } +} \ No newline at end of file diff --git a/Victor.png b/Victor.png new file mode 100644 index 0000000..4c035e1 Binary files /dev/null and b/Victor.png differ diff --git a/Vincent.png b/Vincent.png new file mode 100644 index 0000000..b0007f5 Binary files /dev/null and b/Vincent.png differ diff --git a/Vinicius.png b/Vinicius.png new file mode 100644 index 0000000..735c806 Binary files /dev/null and b/Vinicius.png differ