map.openInfoWindow

Reply

Join Date: Jun 2009
Posts: 132
Reputation: stevenpetersen is an unknown quantity at this point 
Solved Threads: 1
stevenpetersen's Avatar
stevenpetersen stevenpetersen is offline Offline
Junior Poster

map.openInfoWindow

 
-1
  #1
Jul 31st, 2009
How do i style or put html into a map.openInfoWindow (the bubble on google map).
The reason is because i would like to include a picture and style the text.

The code below is just a normal Java API Map that i use. The key has been removed for the customer.

//<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(34.4419, -122.1419), 13);
      }
    }
    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key="
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(37.246147,-121.957769),10);
      var point = new GPoint(-121.9573, 37.2464);
var marker = new GMarker(point);
map.addOverlay(marker);

map.openInfoWindow(map.getCenter(),
                             document.createTextNode("here is what i want to style"));
                             
      map.addControl(new GMapTypeControl());
      map.addControl(new GLargeMapControl());
      map.addControl(new GOverviewMapControl());
}
    }
    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 700px; height: 300px">
</div>

Again thank you for your help
Last edited by stevenpetersen; Jul 31st, 2009 at 12:41 pm. Reason: basic editing
Steven Petersen
Web Designer / Web Master
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 132
Reputation: stevenpetersen is an unknown quantity at this point 
Solved Threads: 1
stevenpetersen's Avatar
stevenpetersen stevenpetersen is offline Offline
Junior Poster

Re: map.openInfoWindow

 
0
  #2
Aug 12th, 2009
is there anyone who can edit a google map on this site or does the daniweb just not like me.
Last edited by stevenpetersen; Aug 12th, 2009 at 12:28 pm.
Steven Petersen
Web Designer / Web Master
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 878
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 141
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: map.openInfoWindow

 
0
  #3
Aug 21st, 2009
This is part of my google script. Hope this helps:

var _map;
var _geocoder;
var _marker;
var _objLocation = null;
var _address = null;

var popupWindows = [];
var gMarkers = [];
var markerCount = 0;

var gAddress = [];
var gDescription = [];

function addItem(pLat, pLong, pTitle, pAddress, pLogo, pDescr) {
    var _mapObject = document.getElementById("googlemap");
    if (_mapObject == null)
        return;

    if (_map == null) {
        _map = new GMap2(_mapObject);
        _map.setCenter(new GLatLng(52.25, 5.4), 9);
        _map.addControl(new GSmallMapControl());
        _map.addControl(new GMapTypeControl());
        _map.checkResize();
    }
    point = new GLatLng(pLat, pLong);

    var customIcon = new GIcon(G_DEFAULT_ICON);
    customIcon.image = "images/marker.png";
    markerOptions = { icon: customIcon, title: pTitle };

    _marker = new GMarker(point, markerOptions);
    if (_marker != null) {
        var param = markerCount;
        GEvent.addListener(_marker, "click", function() {
            showPopup(param);
        });

        gMarkers[markerCount] = _marker;
        _map.addOverlay(_marker);

        gAddress[markerCount] = pAddress;
        gDescription[markerCount] = pDescr;

        popupWindows[markerCount] =
		        '<div><table><tr><td colspan="2" style="height: 80px;">';

        if (pLogo == '') {
            popupWindows[markerCount] += '&nbsp;';
        }
        else {
            popupWindows[markerCount] += '<img src="' + pLogo + '"/>';
        }
		        
        popupWindows[markerCount] +=
		        '</td></tr>' +
		        '<tr><td style="width: 150px; border-right: 1px solid #ddd; padding-right: 10px; height: auto;" valign="top">' +
		        gAddress[markerCount] +
		        '</td><td style="padding-left: 10px;" valign="top">' +
		        gDescription[markerCount] +
		        '</td></tr></table></div>';

        markerCount++;
    }
}

function showPopup(marker) {
    try {
        gMarkers[marker].openInfoWindowHtml(popupWindows[marker]);
    }
    catch (e) { }
}
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 132
Reputation: stevenpetersen is an unknown quantity at this point 
Solved Threads: 1
stevenpetersen's Avatar
stevenpetersen stevenpetersen is offline Offline
Junior Poster

Re: map.openInfoWindow

 
0
  #4
Aug 21st, 2009
pritaeas , thank for replying to this! i did not think anyone was going going to reply to it.

Is thee any way you can break the code above down for me so i know how to properly insall and edit it. This code you sent me looks alot different and i do not want to be installing it wrong in projects. I am not to shear on how to install it as well. I also have another google code i am trying to understand in a form if you want to take a crack at it. API new GLatLng help

Thank you for your time and help,
Steven Petersen
Steven Petersen
Web Designer / Web Master
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 878
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 141
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: map.openInfoWindow

 
0
  #5
Aug 21st, 2009
I'll create a separate working project for you tomorrow. Just a little more patience.

I'm not quite sure what you mean in the other thread. Do you want to add several points to the map ?
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 132
Reputation: stevenpetersen is an unknown quantity at this point 
Solved Threads: 1
stevenpetersen's Avatar
stevenpetersen stevenpetersen is offline Offline
Junior Poster

Re: map.openInfoWindow

 
0
  #6
Aug 21st, 2009
Do you want to add several points to the map ?

Yes, but from a list on a txt. or anotherpage.
Attached Thumbnails
Untitled.png  
Steven Petersen
Web Designer / Web Master
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 878
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 141
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: map.openInfoWindow

 
0
  #7
Aug 22nd, 2009
Hope this will explain things.

A copy of the zip (as rar) can be found here:
http://www.pritaeas.net/public/daniweb/google_map.rar
Last edited by pritaeas; Aug 22nd, 2009 at 5:21 am.
Attached Files
File Type: zip GoogleMap.zip (3.2 KB, 4 views)
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Existing Scripts Forum
Thread Tools Search this Thread



Tag cloud for Existing Scripts
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC