Output all array element with document.write : write « Document « JavaScript Tutorial






<html>
<head>
<title>Writing an Array</title>

</head>
<body>
<P>

<script language="javascript" type="text/javascript">
<!--

var myArray = new Array();
myArray[0] = "AAA";
myArray[1] = "BBB";
myArray[2] = "CCC";
for (var i=0; i<myArray.length; i++) {
  document.write("Element " +i+ " contains: " +myArray[i]+ "<br />");
}

//-->
</script>

</p>

</body>
</html>








14.37.write
14.37.1.Writing to a Document
14.37.2.Use document.write() to output the HTML tags
14.37.3.Use document.write between the HTML tags
14.37.4.Output all array element with document.write
14.37.5.Do calculation in document.write
14.37.6.Escape quotation marks in document.write
14.37.7.Output the HTML tags by using the document.write
14.37.8.document.writeln()