[jQuery] Re: Variable for Google Maps API

2008-05-06 Thread RalphM

Thnak you, Kan, that´s it.

RalphK

On 5 Mai, 18:48, Ken Robinson [EMAIL PROTECTED] wrote:
 On Mon, May 5, 2008 at 12:08 PM, RalphM [EMAIL PROTECTED] wrote:

   Two hours later ;-)

   When I set a variable like this

      var position = new Array(50.1678, -97.133);

   I can do this:

     map.setCenter(new GLatLng(position[0], position[1]),8);

   But when I try something like this:

     meta name=ICBM content=50.1678, -97.133185

   script

   
    var geopos = $(meta[name=ICBM]).attr(content);
    var position = new Array(geopos);
    map.setCenter(new GLatLng(position[0], position[1]),8);
   
   /script

 You need to turn the string into an array. The easiest way to do that
 is to use split():

 var geopos = $(meta[name=ICBM]).attr(content).split(',');
 map.setCenter(new GLatLng(geopos[0], geopos[1]),8);

 Ken


[jQuery] Re: Variable for Google Maps API

2008-05-05 Thread Ken Robinson

On Mon, May 5, 2008 at 12:08 PM, RalphM [EMAIL PROTECTED] wrote:

  Two hours later ;-)

  When I set a variable like this

 var position = new Array(50.1678, -97.133);

  I can do this:

map.setCenter(new GLatLng(position[0], position[1]),8);

  But when I try something like this:


meta name=ICBM content=50.1678, -97.133185

  script

  
   var geopos = $(meta[name=ICBM]).attr(content);
   var position = new Array(geopos);
   map.setCenter(new GLatLng(position[0], position[1]),8);
  
  /script

You need to turn the string into an array. The easiest way to do that
is to use split():

var geopos = $(meta[name=ICBM]).attr(content).split(',');
map.setCenter(new GLatLng(geopos[0], geopos[1]),8);

Ken