Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions TabelaJS.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function tabelaHTML(){

let tabela_csv = document.getElementById("input").value;
let tabela_pronta = document.getElementById("tabela_pronta");

tabela_pronta.innerHTML = "";

let tabela = document.createElement("table");
let tabelaHTML = tabela_csv.split("\n");

tabelaHTML.forEach(linha_tabela => {

let item = linha_tabela.toString().split(",");
let linha = document.createElement("tr");

item.forEach(palavra => {

let texto = document.createElement("td");
let noTexto = document.createTextNode(palavra);

texto.appendChild(noTexto);
linha.appendChild(texto);

})

tabela.appendChild(linha);

});

tabela_pronta.appendChild(tabela);

}
23 changes: 23 additions & 0 deletions meuGetElementByID.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function elementoPorID(no, parametro){

let vetor_de_elementos = [], i;

for(i = 0; i < no.childNodes.length; i++){

let noFilho = no.childNodes[i];

if(noFilho.childNodes.length > 0){

elementoPorID(noFilho, parametro);
}

if(noFilho.tagName == parametro){

vetor_de_elementos.push(noFilho);

}

}

return vetor_de_elementos;
}
22 changes: 22 additions & 0 deletions siteJS.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#titulo{

padding-top: 1em;
text-align: center;
background-color: rgb(43, 100, 43);
width: 100%;
height: 2em;
border-radius: 25px;
}

#tabela_pronta{

padding-top: 10em;

}

tr, td{

border: 1px solid black;
padding: 0.5em;

}
24 changes: 24 additions & 0 deletions siteTabela.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="siteJS.css">

<title>Lidando com Tabelas</title>
</head>
<body>

<script src="Untitled-3.js"></script>

<h1 id="titulo">Lidando com Tabelas</h1>

<h3>Digite a tabela em modelo CSV</h3>
<textarea id="input" rows="10" cols="100"></textarea>
<button id="ad" type="submit" onclick="tabelaHTML()">Enviar</button>

<div id="tabela_pronta"></div>

</body>
</html>
15 changes: 15 additions & 0 deletions umTexto_milImagens.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function umTexto_milImagens(){

let imagens = [].slice.call(document.getElementsByTagName("img"));

imagens.forEach(imagem => {

let nos_parentes = imagem.parentElement;
let texto = document.createTextNode(imagem.alt.toString());

nos_parentes.removeChild(imagem);
nos_parentes.appendChild(texto);

});

}