Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 16th, 2008, 07:34 AM
Authorized User
 
Join Date: Mar 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default google map clicked coordinates

hi friends

how can i find the coordinate if a site visitor clicked my google map?

below is my code for the gmap

thanks


<script src="http://maps.google.com/maps?file=api&key=ABQIAAAA0BO2Ps4DbLymjxuBgZcbgkPN hnwAuBgZcbgkPNhnwAa0Zz7fHWiJUQ" type="text/javascript"></script>
<div id="map" style="width: 300px; height: 300px;"></div>
                †
<script type="text/javascript">
infoWinHtml="hello world";
function loadGMap()
    {
    var map = new GMap(document.getElementById("map"));
    var point = new GPoint(55.176429748535156, 25.104875594635896);
    var marker = new GMarker(point);
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.centerAndZoom(point, 8);

    GEvent.addListener(marker, "click", function()
        {
        marker.openInfoWindowHtml(infoWinHtml);
        //alert("You clicked on" + GEvent. )
        });
    map.addOverlay(marker); †
    }
window.onload=loadGMap;

</script>
Reply With Quote
  #2 (permalink)  
Old June 16th, 2008, 01:44 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Start here:
http://code.google.com/apis/maps/doc...ion/index.html

In the section titled "Audience", click on "Map Events".

On the page that comes up, click on "Event Listeners".

Read.

Pay special attention to the section titled "Using Passed Arguments in Events".

See also this page:
http://code.google.com/apis/maps/doc...ml#Events_GMap
and notice what is passed to your function via a click event.

If you can't get it from these docs, ask again.
Reply With Quote
  #3 (permalink)  
Old June 17th, 2008, 07:31 AM
Authorized User
 
Join Date: Mar 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you dear

the parameters are overlay and point, and i could say point.x and point.y

i just wanted to put a new marker on the clicked position and store the coordinates in the database.





Reply With Quote
  #4 (permalink)  
Old June 17th, 2008, 12:29 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

So did it work??

Or are you still asking how?

I think you are saying it now works, yes?
Reply With Quote
  #5 (permalink)  
Old June 18th, 2008, 07:32 AM
Authorized User
 
Join Date: Mar 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, that was what i wanted and it worked.



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Google Map API Markers msnyder0 Pro PHP 0 October 21st, 2008 07:22 AM
Heat Map over Google Map ajit Javascript 0 March 7th, 2008 08:01 AM
google map GetDirections problem mrjoka Javascript How-To 0 October 4th, 2007 09:08 AM
Map Coordinates dragondayz VB How-To 2 May 8th, 2006 10:52 AM



All times are GMT -4. The time now is 01:01 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.