Hi Andrew, exactly my idea... but I am not clever enough to get it working. Here is the code:
--- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/ TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" / > <title>Title</title> <script type="text/javascript" src="http://maps.google.com/maps? file=api&v=2&key=ABQIAAAAAscyHpliIfrRmPHejjRM2xStmlanpzXYRZFEJkkAb1pqvaoYphQPBqYILQnq-1ePJKdZXgoUw7nPcg&hl=de"></ script> <script type="text/javascript"> function load() { if (GBrowserIsCompatible()) { var map1 = new GMap2(document.getElementById("map-spanisch")); map1.addControl(new GSmallZoomControl()); map1.setCenter(new GLatLng(40,-3),5, G_NORMAL_MAP); map1.addControl(new GOverviewMapControl()); // Create a base icon for all of our markers that specifies the // shadow, icon dimensions, etc. var baseIcon = new GIcon(); baseIcon.image = "http://www.google.com/mapfiles/ mm_20_red.png"; baseIcon.shadow = "http://www.google.com/mapfiles/ shadow50.png"; baseIcon.iconSize = new GSize(20, 34); baseIcon.shadowSize = new GSize(37, 34); baseIcon.iconAnchor = new GPoint(9, 34); baseIcon.infoWindowAnchor = new GPoint(9, 0); baseIcon.infoShadowAnchor = new GPoint(18, 25); // Creates a marker whose info window displays the letter corresponding // to the given index. function createMarker(point, index,title, mtext) { // Create a lettered icon for this point using our icon class var letter = String.fromCharCode("A".charCodeAt(0) + index); var letteredIcon = new GIcon(baseIcon); letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png"; // Set up our GMarkerOptions object var marker = new GMarker(point, {icon:letteredIcon, title:title}); GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(mtext, {maxWidth:50});}); return marker; } map1.addOverlay(createMarker(new GLatLng(38.34,-0.48), 0,"Alicante, Valencia, Spanien", "<a href='javascript:void (0)'>Alicante, Valencia, Spanien</a>")); map1.addOverlay(createMarker(new GLatLng(-23.53,-46.63), 1,"São Paulo, Brasilien", "<a href='javascript:void(0)'>São Paulo, Brasilien</ a>")); } } </script> <script type="text/javascript"> function changeHTML(text_id,new_html){ document.getElementById(text_id).innerHTML = new_html; } </script> </head> <body onLoad="load()" onunload="GUnload()"> <p>Test</p> <div id="map-spanisch" style="width: 560px; height: 350px"></div> <p> </p> <input type='button' onclick='map1.setCenter(new GLatLng(-13,-47),5, G_NORMAL_MAP);' value='Change Map'/> <input type='button' onclick='map1.addOverlay(createMarker(new GLatLng (-9.66,-35.73), 2,\"Maceico, Brasilien\", \"Maceico, Brasilien\"));' value='Add Marker'/> </body> </html> --- I am sure there is only a damn small problem... but I do not know how to call the function correct. Thanks Florian On 19 Aug., 18:04, Andrew Leach <[email protected]> wrote: > On Aug 19, 4:17 pm, schae09 <[email protected]> wrote: > > > Example: I set a marker in Germany opening a info-windows saying "It > > is also nice in Brazil". When the user klicks the link I want the map- > > center to move Brazil... but how? > > You already know how to centre the map, so it's just a question of > triggering that when a link is clicked. > > http://www.google.com/search?q=Javascript+onclick+event+handler > > > Do you see a possibility to add new (additional) markers to a map by > > klicking a link? > > Same method of triggering a different end result. > > Andrew --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
