Javascript:
function looparrayFunction() {
var inpt = document.getElementById('num5').value;
var nums = inpt.split(',');
var outpt = "";
// Do NOT use 'in' for arrays
for (var x = 0; x < nums.length; x++) {
outpt = outpt + nums[x] + "
";
}
document.getElementById('label5').innerHTML = outpt;
}
HTML:
Number: [input type="text" value="5,2,3,1,4" id="num5" name="num5" />
[button id="button5" type="button" onclick="looparrayFunction();" >Loop thru an array[/[button>
[label id="label5" />