Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function procediInserimento() {
- var varid = document.getElementById("inputID").value;
- var varNome = document.getElementById("inputNome").value;
- var varCognome = document.getElementById("inputCognome").value;
- var varData = document.getElementById("inputDataNascita").value;
- var dati = [];
- var check = true;
- if(varNome.trim().length === 0){
- alert("Campo nome non riempito");
- }
- else if(varCognome.trim().length === 0){
- alert("Campo cognome non riempito");
- }
- else if(varData.trim().length === 0){
- alert("Campo data non riempito");
- }
- else{
- for(int i = 0; i < arrayPersone.lenght; i++){
- if(arrayPersone[i][0] == varId){
- check = false;
- }
- }
- if(check){
- dati = [varid,varNome,varCognome,varData];
- var persona = "<tr>";
- persona += "<td>" + varid + "</td>";
- persona += "<td>" + varNome + "</td>";
- persona += "<td>" + varCognome + "</td>";
- persona += "<td>" + varData + "</td>";
- persona += "</tr>";
- elencoPersone += persona;
- arrayPersone.push(dati);
- document.getElementById("contenuto_tabella").innerHTML = elencoPersone;
- }
- }
- }
- var elencoPersone = "";
- var arrayPersone = [];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement