<script src="http://maps.google.com/maps?
file=api&v=2.x&sensor=false&key=ABQIAAAAk9Dek7lEou_IU1mjaZSuURScaf-
CopB2LBRbNMGvsOgJmuzEghSAz7Mf6TCWlo3aef8OVXacSrB1YQ" type="text/
javascript"></script>
<script src="http://www.google.com/uds/api?
file=uds.js&v=1.0&key=ABQIAAAAk9Dek7lEou_IU1mjaZSuURScaf-
CopB2LBRbNMGvsOgJmuzEghSAz7Mf6TCWlo3aef8OVXacSrB1YQ" type="text/
javascript"></script>
<script>
var map;
var localSearch = new GlocalSearch();
var icon = new GIcon(G_DEFAULT_ICON);
icon.image = "http://www.google.com/mapfiles/marker.png";;
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";;
icon.iconSize = new GSize(20, 34);
icon.shadowSize = new GSize(37, 34);
icon.iconAnchor = new GPoint(10, 34);

function usePointFromPostcode(postcode) {
        localSearch.setSearchCompleteCallback(null, function() {
                if (localSearch.results[0])     {
                        var resultLat = localSearch.results[0].lat;
                        var resultLng = localSearch.results[0].lng;
                        var point = new GLatLng(resultLat,resultLng);
                        var marker = new GMarker(point,icon);
                        map.addOverlay(marker);
                        map.setCenter(point, 15, G_NORMAL_MAP);
                }else{alert("Postcode not found!");
                }
        });
localSearch.execute(postcode + ", UK");



}


function mapLoad() {
        if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
                map.addControl(new GLargeMapControl());
                map.addControl(new GMapTypeControl());
                map.setCenter(new GLatLng(54.622978,-2.592773), 5,
G_NORMAL_MAP);
                usePointFromPostcode("LS2 2RD");
        }


}


function addLoadEvent(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
                window.onload = func;
        } else {
                window.onload = function() {
                        oldonload();
                        func();
                }
        }


}


function addUnLoadEvent(func) {
        var oldonunload = window.onunload;
        if (typeof window.onunload != 'function') {
                window.onunload = func;
        } else {
                window.onunload = function() {
                        oldonunload();
                        func();
                }
        }

}


addLoadEvent(mapLoad);
addUnLoadEvent(GUnload);
</script>
You can try with any UK post code besides LS2 2RD in the above.
With IE8/FF/Safari, it is absolutely fine, but under IE6/IE7,  it says
GIcon undefined. Please help, million thanks!

-- 
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