Thanks Mike,

Obviously I am new at this and am really appreciating your help.

I still can't get it to show the marker. Without out the second script
section below, which I found from your tutorials, and setting the
mapcenter above I can get it to center where I want, then do
directions after they submit the form.

Take a look at how it looks now. www.dalelarsen.com/beta/reception.asp.
View the source to see how I have it currently working.

Then after adding the script to show the markers it throws an error.

This is what I have now.

<script type="text/javascript">

if (GBrowserIsCompatible()) {


            <!--
                        var map;
                        var gdir;
                        var geocoder = null;
                        var addressMarker;

                        function initialize() {
                                    if (GBrowserIsCompatible())
{
                                    map = new
GMap2(document.getElementById("map_canvas"));
                                    gdir = new GDirections(map,
document.getElementById("directions"));
                                                map.addControl(new
GSmallMapControl());
                                                map.addControl(new
GMapTypeControl());
                                    GEvent.addListener(gdir, "load",
onGDirectionsLoad);
                                    GEvent.addListener(gdir, "error",
handleErrors);



                                    }
                        }

                        function setDirections(fromAddress, toAddress,
locale) {
                                    gdir.load("from: " + fromAddress +
" to: " + toAddress,
 
{ "locale": locale });
                        }

                        function handleErrors(){
                                     if (gdir.getStatus().code ==
G_GEO_UNKNOWN_ADDRESS)
                                     alert("No corresponding
geographic location could be found for one of the specified addresses.
This may be due to the fact that the address is relatively new, or it
may be incorrect.\nError code: " + gdir.getStatus().code);
                                     else if (gdir.getStatus().code ==
G_GEO_SERVER_ERROR)
                                     alert("A geocoding or directions
request could not be successfully processed, yet the exact reason for
the failure is not known.\n Error code: " + gdir.getStatus().code);

                                     else if (gdir.getStatus().code ==
G_GEO_MISSING_QUERY)
                                     alert("The HTTP q parameter was
either missing or had no value. For geocoder requests, this means that
an empty address was specified as input. For directions requests, this
means that no query was specified in the input.\n Error code: " +
gdir.getStatus().code);

                        //          else if (gdir.getStatus().code ==
G_UNAVAILABLE_ADDRESS)   <--- Doc bug... this is either not defined,
or Doc is wrong
                        //          alert("The geocode for the given
address or the route for the given directions query cannot be returned
due to legal or contractual reasons.\n Error code: " +
gdir.getStatus().code);

                                     else if (gdir.getStatus().code ==
G_GEO_BAD_KEY)
                                     alert("The given key is either
invalid or does not match the domain for which it was given. \n Error
code: " + gdir.getStatus().code);

                                     else if (gdir.getStatus().code ==
G_GEO_BAD_REQUEST)
                                     alert("A directions request could
not be successfully parsed.\n Error code: " + gdir.getStatus().code);

                                     else alert("An unknown error
occurred.");

                        }

                        function onGDirectionsLoad(){
                                    // Use this function to access
information about the latest load()
                                    // results.

                                    // e.g.
                                    //
document.getElementById("getStatus").innerHTML =
gdir.getStatus().code;
                                    // and yada yada yada...
                        }

            //-->
</script>
<script type="text/javascript">
    //<![CDATA[

    if (GBrowserIsCompatible()) {

      // A function to create the marker and set up the event window
      // Dont try to unroll this function. It has to be here for the
function closure
      // Each instance of the function preserves the contends of a
different instance
      // of the "marker" and "html" variables which will be needed
later when the event triggers.
      function createMarker(point,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }

      // Display the map, with some controls and set the initial
location
      var map = new GMap2(document.getElementById("map_canvas"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
            map.setCenter(new GLatLng(41.30421528745789,
-111.96381568908691), 16);

      // Set up three markers with info windows

      var point = new GLatLng(41.30421528745789, -111.96381568908691);
              var marker = createMarker(point,'<div style="width:
240px">Some stuff to display in the First Info Window. With a <a
href="http://www.econym.demon.co.uk";>Link</a> to my home page</div>')
              map.addOverlay(marker);

    }

    // display a warning if the browser was not compatible
    else {
      alert("Sorry, the Google Maps API is not compatible with this
browser");
    }

    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/
    // http://econym.googlepages.com/index.htm

    //]]>
    </script>
<BODY background="images/bg.jpg" LEFTMARGIN=0 TOPMARGIN=0
MARGINWIDTH=0 MARGINHEIGHT=0 onunload="GUnload()"
onload="initialize();>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to