Javascript Variables - Select and Mix
I have two to three variables that I want to mix into strings and then
place them all into a table, however I can't figure out how to make the
variables mix.
What I have is
document.write('<table cellspacing="0" cellpadding="5">')
var a = ["String1", "String2"]
var n = ["string3", "String4"]
for(var i=0; i <a.length; i++){
document.write('<tr'>
document.write('td' + (a[i]) + (b[i]) +'</td>')
document.write('</td>')
}
document.write('</table>')
This does create the table I want however it doesn't perform the function
I am looking for.
It creates a table that goes:
"string1" "string3"
"string2" "string4'
I'm looking for:
"string1" "string3"
"string1" "string4"
"string2" "string3"
"string2" "string4"
Hopefully that makes sense. I've tried searching through the internet and
on Stack Overflow to no avail. How would I make this happen? Eventually
the arrays should be able to grow to maybe a hundred each...
No comments:
Post a Comment