Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 5th, 2008, 07:47 AM
Authorized User
 
Join Date: Jul 2008
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to ramone_johnny
Default Hacked Bills Google Maps Code

Bill,
Ive just successfully hacked away at your code and got it working. Dont ask me how but Im sure as hell it cant be right. *shrugs*

Anyway, would you mind taking a look at it and correcting it where necessary (as well as telling me how badly written it is)

<script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var latitudes = new Array( );
        var longitudes = new Array( );
        var markers = new Array();

        var mappy = new GMap2(document.getElementById("mappy"));
        mappy.setCenter(new GLatLng(<%=share_latitude%>, <%=share_longitude%>), 15);
        latitudes = <%=share_latitude%>;
        longitudes = <%=share_longitude%>;
        var icon = new GIcon();
        icon.image = "/images/marker1.png"
        icon.shadow = "/images/shadow-marker1.png";
        icon.iconSize = new GSize(16.0, 33.0);
        icon.shadowSize = new GSize(33.0, 33.0);
        icon.iconAnchor = new GPoint(8.0, 30.0);
        icon.infoWindowAnchor = new GPoint(8.0, 16.0);

        markers[1] = new GMarker(new GLatLng(<%=share_latitude%>, <%=share_longitude%>), icon);
        // Show info about this marker when it is clicked
        //GEvent.addListener(markers[1], "click", function() { markers[1].openInfoWindowHtml("Address:<br/><%=addr%>"); } );
        // and add this marker:
        mappy.addOverlay(markers[1]);
      }
    }
</script>

webdesigndocuments.com
__________________
Works Media - Online Marketing & SEO
 
Old August 5th, 2008, 12:42 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Aside from creating arrays that you never use in this code, it seems simple enough and correct enough.

Just change the lines
        var latitudes = new Array( );
        var longitudes = new Array( );
to
        var latitudes;
        var longitudes;

And you don't really need the markers array, but it won't hurt anything.
 
Old August 5th, 2008, 07:19 PM
Authorized User
 
Join Date: Jul 2008
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to ramone_johnny
Default

Thanks Bill,
Is there a way if the user hasnt specified an actual street address (meaning, they have only submitted a suburb) to NOT show the marker.

At the moment the marker is showing regardless, and its often confusing.

John

webdesigndocuments.com
 
Old August 5th, 2008, 07:24 PM
Authorized User
 
Join Date: Jul 2008
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to ramone_johnny
Default

Ooh, I think I have it *pumps eyebrows

Hows this look?

<%if share_street <> "" then%>
        markers[1] = new GMarker(new GLatLng(<%=share_latitude%>, <%=share_longitude%>), icon);
        // Show info about this marker when it is clicked
        //GEvent.addListener(markers[1], "click", function() { markers[1].openInfoWindowHtml("Address:<br/><%=addr%>"); } );
        // and add this marker:
        mappy.addOverlay(markers[1]);
        <%end if%>

webdesigndocuments.com
 
Old August 5th, 2008, 09:45 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Looks right to me.
 
Old August 5th, 2008, 10:11 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

By the by... The "demo" he is referring to is the first one here:
     http://www.clearviewdesign.com/clear...bie/demos.html

But I just noticed that I forgot to provide a link to the ASP source code! I'll add that ASAP.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Bills Whiz Bang Google Maps ramone_johnny Classic ASP Basics 2 August 1st, 2008 07:23 PM
Google Maps JS in ASPX page error kingroon ASP.NET 2.0 Basics 0 December 7th, 2007 09:52 AM
INFO: Adding Google Maps (New ASP.Net Control) jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 September 12th, 2007 03:18 AM
XSL, Javascript and Google maps.. tomharding XSLT 2 March 14th, 2007 06:10 PM
Site Hacked!!! (Please help) ishh_sh Classic ASP Professional 9 January 24th, 2007 03:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.