源代码 :
点击运行
<!DOCTYPE html> <html> <body> <script> var i; var cars = new Array(); cars[0] = "Saab"; cars[1] = "Volvo"; cars[2] = "BMW"; for (i=0;i<cars.length;i++) { document.write(cars[i] + "<br>"); } </script> </body> </html>
运行结果