diff --git a/getByName/index.html b/getByName/index.html new file mode 100644 index 0000000..a16a20a --- /dev/null +++ b/getByName/index.html @@ -0,0 +1,20 @@ + + + + + + + getByName(elem) + + + + + + +

TESTE QUANTOS ELEMENTOS POSSUEM CERTA TAG


+

Escreva a função no console e coloque como atributos onde começa e o nome da tag


+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis, nulla enim? Iure minus numquam ipsum quis voluptas? Ipsam, accusamus minima! Quas dignissimos nam, blanditiis nesciunt voluptatum non rem illum amet?


+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod, debitis. Animi eum aliquam asperiores necessitatibus voluptatibus earum laudantium? Consequatur fuga laborum reiciendis expedita voluptates vero commodi excepturi provident voluptatem omnis.

+ + + \ No newline at end of file diff --git a/getByName/script.js b/getByName/script.js new file mode 100644 index 0000000..5cd506a --- /dev/null +++ b/getByName/script.js @@ -0,0 +1,13 @@ +function getByName(node, string) { + string.toUpperCase() + var listaElementos = []; + + for (var i = 0; i < node.childNodes.length; i++) { + var childNode = node.childNodes[i]; + if(childNode.childNodes.length > 0) getByName(childNode, string); + if(childNode.tagName == string && childNode.tagName !== null) listaElementos.push(childNode); + } + console.log(listaElementos); + return listaElementos; + } + diff --git a/imgParaTexto/index.html b/imgParaTexto/index.html new file mode 100644 index 0000000..e8797d3 --- /dev/null +++ b/imgParaTexto/index.html @@ -0,0 +1,24 @@ + + + + + + + Um texto vale mais que mil imagens... + + + + + +
+ +

Aperte para transformar em texto


+ + fotinha

+
+ +
+
+ + + \ No newline at end of file diff --git a/imgParaTexto/pfp.jpg b/imgParaTexto/pfp.jpg new file mode 100644 index 0000000..e312a9d Binary files /dev/null and b/imgParaTexto/pfp.jpg differ diff --git a/imgParaTexto/script.js b/imgParaTexto/script.js new file mode 100644 index 0000000..d6ad753 --- /dev/null +++ b/imgParaTexto/script.js @@ -0,0 +1,12 @@ +function imgParaTexto() { + var imgs = document.getElementsByTagName("img"); + + for (let i = 0; i < imgs.length; i++) { + + var pai = imgs[i].parentElement; + var texto = imgs[i].alt; + var textNode = document.createTextNode(texto); + pai.replaceChild(textNode, imgs[i]); + + } +} \ No newline at end of file diff --git a/tabelas/index.html b/tabelas/index.html new file mode 100644 index 0000000..7c04ae9 --- /dev/null +++ b/tabelas/index.html @@ -0,0 +1,37 @@ + + + + + + + Converta CSV para HTML!! + + + + + +
+ +

Converter CSV para HTML!!


+ +
+
+
+
+ +
+

Dados da tabela:

+ +
+ +
+ +
+ +

+
+ +
+ + + \ No newline at end of file diff --git a/tabelas/script.js b/tabelas/script.js new file mode 100644 index 0000000..aad1c6f --- /dev/null +++ b/tabelas/script.js @@ -0,0 +1,34 @@ +function CSVparaHTML(){ + + let titulo_input = document.getElementById("titulo-input").value; + let csv_input = document.getElementById("csv-input").value; + + let titulo = document.createTextNode(titulo_input); + + let titulo_tabela = document.getElementById("titulo_tabela"); + let conteudo = document.getElementById("conteudo"); + + titulo_tabela.appendChild(titulo); + + let tabela = document.createElement("tabela"); + let tabelaCSV = csv_input.split("\n"); + + tabelaCSV.forEach(function(linhas) { + + let colunas = linhas.toString().split(","); + let linha = document.createElement("tr"); + + colunas.forEach(function(celulas){ + let celula = document.createElement("td"); + celula.style.border = "1px solid black"; + let valor = document.createTextNode(celulas); + celula.appendChild(valor); + linha.appendChild(celula); + + }) + tabela.appendChild(linha); + + }); + + conteudo.appendChild(tabela); +} \ No newline at end of file