Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as HTML by jjhhhkkk ( 2 years ago )
<html>
<head>
<style>
table, th, td{
border: 1px solid black;
border-collapse: collapse;
}
th, td{
padding: 5px 35px 5px 10px;
}
</style>
<script>
function buscar(){
var json1 = {};
json1.ra = 1;
json1.nome = "Leandro";
json1.curso = "tads";
var json2 = {};
json2.ra = 2;
json2.nome = "Marlene";
json2.curso = "enfermagem";
var json3 = {};
json3.ra = 3;
json3.nome = "Adair";
json3.curso = "engenharia";
var vetor_json = [];
vetor_json.push(json1);
vetor_json.push(json2);
vetor_json.push(json3);
var linhas_da_tabela = "";
for(i=0;i<=vetor_json.length-1;i++){
var ra = vetor_json[i].ra;
var nome = vetor_json[i].nome;
var curso = vetor_json[i].curso;
var linha = `<tr>
<td>${ra}</td>
<td>${nome}</td>
<td>${curso}</td>
</tr>`;
linhas_da_tabela += linha;
}
document.getElementById('corpo_tabela').innerHTML = linhas_da_tabela;
}
</script>
</head>
<body>
Ra......:<input type="text" name=""><br>
Nome.:<input type="text" name=""><br>
Curso..:<input type="text" name=""><br><br>
<input type="button" value="Buscar" onclick="buscar()"/><br><br>
<table>
<thead>
<tr>
<th>RA</th><th>NOME</th><th>CURSO</th>
</tr>
</thead>
<tbody id="corpo_tabela">
</tbody>
</table>
</body>
</html>
Revise this Paste