编辑您的代码:
<html>
<body>
<script type="text/javascript">
var x var mycars = new Array()
mycars[0] = "Saab"
mycars[1] = "Volvo"
mycars[2] = "BMW"
for (x in mycars)
{
document.write(mycars[x] + "<br />")
}
</script>
</body>
</html>
查看结果:
Saab
Volvo
BMW