A dynamic table with JavaScript
Hi, i am doing a function for a dynamic table in JavaScript, this table modify its depending on the amount of information that is entered, but the code not work. <!DOCTYPE html> <html> <head> <title>Prueba Tabla</title> </head> <body> <table id="Tabla" border=3></table> <script type="text/javascript"> var ES = ["Hola","Como","Estas","?"]; var EN = ["Hi","How","Are","You","?"]; var Longitud; var Texto; var Tabla = document.getElementById("Tabla"); if(ES.length >= EN.length){ Longitud = ES.lenght; } else{ Longitud = EN.lenght; } Texto = ""; for (var x = 0; x <= Longitud-1; x++) { Texto = Texto + "<tr><td>" + ES[x] + "</td><td>" + EN[x] + "</td></tr>"; } Tabla.innerHTML = Texto; </script> </body> </html> I do this example with the sentence "How are you?" in english and spanish "Como estas?". Please help. PD: Sorry if i commited a mistake, but i am learning english. 2PD: In the example I did not do a function to the table until I already had the code ready, so it makes me easier to understand it, but when it works, I make it a function.