webmaster programmatore php mysql java javascript

Web Developer

GUIDA JQUERY (TUTORIAL) 13. GESTIONE ARRAY MULTIDIMENSIONALI JAVASCRIPT
./image/upload/18-07-2016-09-57-24.jpg

foto-1

Creare un array multidimensionale è semplice come una matrice.

Ecco un array multidimensionale:


<p id="demo"></p>
<button onclick="myFunction()">Try it</button>
<script>
var matrice=[
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0],
[2,2,1,1,1,1,1,1,2,2,2,2,2,2,2,2],
[2,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],
];

function myFunction() {
    x = document.getElementById("demo")
    for(i=0;i<matrice[0].length;i++)
{
for(j=0;j<matrice[1].length;j++)
{
x.innerHTML = x.innerHTML+matrice[i][j];
}
x.innerHTML = x.innerHTML+"<br>";
}
}
</script>


Questo piccolo script al click sul bottone Try it stampa tutto il contenuto dell'array multidimensionale.

Buon Divertimento

Developer - Problem Solver - Business Intelligence

PHP

Javascript - JQuery

Css

SQL

Panthera ERP

Crystal Report

Qlik View - Qlik Sense

Programmatore web - Webmaster Elio Curtacci
Made with made in italy in Italy
Questo sito web utilizza i COOKIE per dare all'utente un esperienza di visita migliore.

LOG-IN