Add new button to Google Maps

Showing 1-9 of 9 messages
Add new button to Google Maps Yi 5/21/08 2:53 PM
Hi all,

I'm trying to add a button at the top right hand corner of the map.
When pressed, will run some Javascript code I have.  I have three
questions:

So far I am able to create the button:

var deleteTrackButton = new GMapType(G_SATELLITE_MAP.getTileLayers()
[0], new GMercatorProjection(15), "Delete Track");
map.addMapType( deleteTrackButton );

1. How do I make pressing this button run a Javascript function of
mine?
2. How do I remove this button?
3. How do I align this button on another row.  Right now, it sits in
the same row as the default buttons ( map, satellite, hybrid ).

Thanks in advanced for any support.
Re: Add new button to Google Maps Ivan 5/21/08 3:23 PM
You will need to add a call to the javascript on the buttons onclick
event.


--
Explore Belize -- http://www.belizemapia.com
--
Re: Add new button to Google Maps Yi 5/22/08 6:54 AM
Is there a concrete example of this?

On May 21, 6:23 pm, Ivan <ivan.v...@gmail.com> wrote:
> You will need toadda call to the javascript on the buttons onclick
> event.
>
> --
> Explore Belize --http://www.belizemapia.com
> --
>
> On May 21, 3:53 pm, yizhao <yi1z...@gmail.com> wrote:
>
>
>
>
>
> > Hi all,
>
> > I'm trying toaddabuttonat the top right hand corner of the map.
> > When pressed, will run some Javascript code I have.  I have three
> > questions:
>
> > So far I am able to create thebutton:
>
> > var deleteTrackButton = new GMapType(G_SATELLITE_MAP.getTileLayers()
> > [0], new GMercatorProjection(15), "Delete Track");
> > map.addMapType( deleteTrackButton );
>
> > 1. How do I make pressing thisbuttonrun a Javascript function of
> > mine?
> > 2. How do I remove thisbutton?
> > 3. How do I align thisbuttonon another row.  Right now, it sits in
RE: Add new button to Google Maps Ralph 5/22/08 6:57 AM
Can you post a link to your map?

Ralph


Re: Add new button to Google Maps Yi 5/22/08 8:08 AM
Here is a link to an example of what I want to do.  I added a button
called "Delete Track".

http://userpages.umbc.edu/~yizhao1/

1.  When the "Delete Track" button is clicked, how do I run a
Javascript function?  Currently, there are screen blanks out when I
click that button.  Shouldn't it do nothing?

2.  How do I get ride of this button after it has been clicked?
Re: Add new button to Google Maps Yi 5/22/08 9:30 AM
anyone?

On May 22, 11:08 am, yizhao <yi1z...@gmail.com> wrote:
> Here is a link to an example of what I want to do.  I added abutton
> called "Delete Track".
>
> http://userpages.umbc.edu/~yizhao1/
>
> 1.  When the "Delete Track"buttonis clicked, how do I run a
> Javascript function?  Currently, there are screen blanks out when I
> click thatbutton.  Shouldn't it do nothing?
>
> 2.  How do I get ride of thisbuttonafter it has been clicked?
Re: Add new button to Google Maps Esa 5/22/08 9:46 AM
It is a very creative idea to hack an external button by creating a
phantom maptype. However I don't think that is the right way if you
like that button to do what you intend.

You should build your button as a custom GControl(). There are
examples even in the official documentation. E.g:
http://code.google.com/apis/maps/documentation/examples/control-custom.html
RE: Add new button to Google Maps Ralph 5/22/08 9:46 AM
Re: Add new button to Google Maps Yi 5/22/08 10:50 AM
Thanks for the link.  I took that and ran with it.
> examples even in the official documentation. E.g:http://code.google.com/apis/maps/documentation/examples/control-custo...