创建数组

  1. <html>
  2. <body>
  3.  
  4. <script type="text/javascript">
  5. var mycars = new Array()
  6. mycars[0] = "Saab"
  7. mycars[1] = "Volvo"
  8. mycars[2] = "BMW"
  9.  
  10. for (i=0;i<mycars.length;i++)
  11. {
  12. document.write(mycars[i] + "<br />")
  13. }
  14. </script>
  15.  
  16. </body>
  17. </html>