<html>
<head>
<title>Define two arrays and use for statement to ouput their values</title>
</head>
<body>
<h1>Define two arrays and use for statement to ouput their values</h1>
<table border="1">
<script language="javascript" type="text/javascript">
<!--
var myArray = new Array();
myArray[0] = "A";
myArray[1] = "B";
myArray[2] = "C";
myArray[3] = "D";
myArray[4] = "E";
var myArray2 = new Array();
myArray2[0] = "1";
myArray2[1] = "2";
myArray2[2] = "3";
myArray2[3] = "4";
myArray2[4] = "5";
for (var i=0; i<myArray.length; i++) {
document.write("<tr><td>" + myArray[i] + "</td>");
document.write("<td>" + myArray2[i] + "</td></tr>");
}
//-->
</script>
</table>
</body>
</html>
|