SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2007
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Google Maps marker text not appearing

    Hi,

    I have this Google Map code in which I want to display a simple pointer and text, but the text is not appearing.
    Any ideas why?

    Thanks.

    PHP Code:
    function initialize() {
      var 
    myLatlng = new google.maps.LatLng(48.893642.33739);
      var 
    mapOptions = {
        
    zoom13,
        
    centermyLatlng
      
    }
      var 
    map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);


        
      var 
    marker = new google.maps.Marker({
          
    positionmyLatlng,
          
    mapmap,
          
    title'Hello World!'
      
    });
    }

    google.maps.event.addDomListener(window'load'initialize);
    initialize(); 

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,301
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Some things to check:

    - have you linked to the Google Maps api on the same page (and above the code you posted)?
    - have you placed a container on the page with an ID of 'map-canvas'?

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2007
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yes I have it included and also using a div with the id of map-canvas.

    Any other ideas?
    Thanks

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,301
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    When you say the text is not appearing, what are you expecting to happen? The marker is given a title attribute of "Hello World". Titles appear when you hover over a marker. Your code does that.


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
  •