SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,099
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Google maps object

    This should be simple, I am adding a marker but there is a var called location that I think is an object.
    I have this in a function.
    Code:
        marker = new google.maps.Marker({
          position: location,
          map: map
        });
        markersArray.push(marker);
    
    // the alert shows the correct location, lat lon.
    alert(location);
    
    // however replace has the error "Object doesn't support this property or method"
    var lat_lon = location.replace(/3/i,"");
    location is passed to the function as latLon as an on click event.

    Thanks for looking.
    What I lack in acuracy I make up for in misteaks

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You're trying to do a replace, which is a method of the String class.

    If you want to replace a value in the lat_lon you will probably need to access one of the properties of the object first (and possibly convert it to a string first).

    E.g:
    Code:
    lat_lon.latitude.replace(/3/i, "")
    btw you might want to check what the actual property is that you want to modify
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


Bookmarks

Posting Permissions

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