diff --git a/Respostas/E01.js b/Respostas/E01.js new file mode 100644 index 0000000..c8ff697 --- /dev/null +++ b/Respostas/E01.js @@ -0,0 +1,28 @@ +function transforma(texto){ + var vetorTexto=[]; + var lines = texto.split('\n'); + for(i=0; i < lines.length; i++){ + vetorTexto[i] = lines[i].split(','); + } + return vetorTexto; +} + +function submeter(){ + var tbl = document.getElementsByTagName("table")[0]; + var text = document.getElementsByTagName("textarea")[0].value; + var Tabela = transforma(text); + while(tbl.childNodes.length>0){ + tbl.removeChild(tbl.childNodes[0]); + } + for(i = 0; i < Tabela.length;i++){ + var li = document.createElement("tr"); + for( w = 0; w < Tabela[i].length; w++){ + var colunas = document.createElement("td"); + var value = document.createTextNode(Tabela[i][w]); + colunas.appendChild(value); + li.appendChild(colunas); + } + tbl.appendChild(li); + + } +} diff --git a/Respostas/E02.js b/Respostas/E02.js new file mode 100644 index 0000000..35d5dd7 --- /dev/null +++ b/Respostas/E02.js @@ -0,0 +1,16 @@ +function getByName(elem){ + var array = [] + busca(document.body, elem.toUpperCase(), array) + return array +} + +function search(node, tag, arrayElements){ + for (var filho of node.childNodes){ + if (filho.childNodes.length != 0) { + search(filho, tag, arrayElements) + } + if (filho.tagName == tag) { + arrayElements.push(filho) + } + } return arrayElements +} \ No newline at end of file diff --git a/Respostas/E03.js b/Respostas/E03.js new file mode 100644 index 0000000..71f1051 --- /dev/null +++ b/Respostas/E03.js @@ -0,0 +1,24 @@ +function removeImagens(){ + var parent = document.getElementById("div1"); + var child = document.getElementsByTagName("img"); + while(child.length > 0){ + console.log(child.length); + parent.removeChild(child[0]); + } + + var QuebraLinha = document.createElement("br"); + var criaElem = document.createElement("p"); + var node = document.createTextNode("Primeira imagem: Professor Leandro Maia segurando um vira-lata caramelo assustado de sainha (no caso o chocorro está de saia, não o professor.)"); + criaElem.appendChild(node); + criaElem.appendChild(QuebraLinha); + var elem = document.getElementsByTagName("div"); + elem[0].appendChild(criaElem); + + QuebraLinha = document.createElement("br"); + criaElem = document.createElement("p"); + node = document.createTextNode("Segunda imagem: Professor Humberto Honda sendo humilde e pegando ônibus com seus alunos."); + criaElem.appendChild(node); + criaElem.appendChild(QuebraLinha); + elem = document.getElementsByTagName("div"); + elem[0].appendChild(criaElem); +} diff --git a/Respostas/index.html b/Respostas/index.html new file mode 100644 index 0000000..97bcbb0 --- /dev/null +++ b/Respostas/index.html @@ -0,0 +1,28 @@ + + +
++ Digite as informações da tabela separando os itens de cada linha com vírgula: +
+ +
+
+