Sun Sep 18, 2011 12:22 am
<html>
<title>Multi-dimensional array javascript example</title>
<head>
<script language="JavaScript" type="text/JavaScript">
var sportStars = new Array (
["Red", "20 cars", "45 motorcycle"],
["Blue", "30 cars", "3 motorcycle"],
["Black", "4 cars", "3 motorcycle"],
["White", "3 cars", "2 motorcycle"]
)
</script>
</head>
<body>
<script language="JavaScript" type="text/JavaScript">
document.write("<table><tr><th width=\"150\">Color<th width=\"150\">Available Cars<th width=\"150\">Available motorcycle</tr>");
for (a=0;a<=3;a++){
document.write("<tr><td align='center'>" + sportStars[a][0] + "</td><td align='center'>" + sportStars[a][1] + "</td><td align='center'>" + sportStars[a][2] + "</td></tr>");
}
document.write("</table>");
</script>
</body>
</HTML>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.