<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>数组遍历</title>
<style type="text/css">
#show{
font: 16px;
background:red;
width:200px;
}
</style>
<script type="text/javascript" >
var a = [3,5,6,2,1,4];
var str="";
document.write("<div id='show'>");
for(var index in a)
{
str+="数组的第"+(parseInt(index)+1)+"个元素:"+a[index]+"<br/>";
}
document.write(str+"</div>");
</script>
</head>
<body>
</body>
</html>