Generating javascript variables

HI All,

I am trying to generate javascript variables. It looks right in the source, but causes a problem.

Can someone have a look and tell me why.

I have a php script that is pulling out a load of map icons from a database:

www.southhams.org/map.php
www.southhams.org/map.php?test=test

Thanks

Will


var 1 = '/images/map_icons/airport.png';
var 2 = '/images/map_icons/artgallery.png';
var 3 = '/images/map_icons/bank.png';
...

It is invalid to use a number as an identifier.
What you can do is to use an array to store the info, so that you can then use an array index to retrieve the values:


var icons = [
    '/images/map_icons/airport.png',
    '/images/map_icons/artgallery.png',
    '/images/map_icons/bank.png',
    ...
];

Thanks Paul. “It is invalid to use a number as an identifier.” - all I need