www.webdeveloper.com
Results 1 to 2 of 2

Thread: new Array syntax error...? Very frusterating! I don't see a problem here.

  1. #1
    Join Date
    Apr 2010
    Posts
    2

    new Array syntax error...? Very frusterating! I don't see a problem here.

    Hey all,

    I'm putting together a web-app that creates DOM elements from an array and I'm having trouble getting my array to work properly...

    Here's what I've got, maybe some fresh eyes could help me out

    When I load the page I get a:
    Error: syntax error
    Source File: http://localhost/vehicle.load.js
    Line: 5
    Source Code:var application0 = new Array ();


    Code:
    window.onload = loadVehicles;
    
    function loadVehicles() {
    var application0 = new Array ();
    application0[0] = "Volkswagen";
    application0[1] = "Rabbit";
    application0[2] = "1980 - 1984";
    
    var application1 = new Array ();
    application1[0] = "Volkswagen";
    application1[1] = "Rabbit GTI";
    application1[2] = "1983 - 1984";
    
    }

  2. #2
    Join Date
    Apr 2010
    Posts
    2

    I've found the solution!

    I figured it out... If any of you ever run into this issue, consider the following!

    I didn't paste all of my code in the original post. The line right above declared the script type of the file...

    Code:
    <script type="text/javascript">
    Anyway, I felt I needed to declare the file type because I'm using a php file as a javascript file. That is not the case!

    As soon as I wiped out that line, the function worked perfectly.

    Good to know

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles