Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][PHP] Google Maps link to marker
piotrd
post
Post #1





Grupa: Zarejestrowani
Postów: 174
Pomógł: 0
Dołączył: 16.05.2006
Skąd: Łódź

Ostrzeżenie: (0%)
-----


w sekcji HEAD pobieram z SQL w pętli współrzędne i otrzymuję w efekcie

  1. <script type="text/javascript">
  2. function mapa() {
  3. var opcje = {zoom: 15, center: pozycja, mapTypeId: google.maps.MapTypeId.ROADMAP}
  4. var mapa = new google.maps.Map(document.getElementById("GoogleMap"), opcje);
  5. var pozycja = new google.maps.LatLng(51.7596551014072, 19.45899602920531);
  6. var dymek = new google.maps.InfoWindow();
  7. var flaga = 'x.png';
  8.  
  9. var a_43 = new google.maps.InfoWindow ({content: '<p><span class="title">test5</span>,<br /><br />5</p>'});
  10. var b_43 = new google.maps.LatLng(51.76191289573248, 19.447795124359118);
  11. var c_43 = new google.maps.Marker({position: b_43, map: mapa, icon: flaga});
  12. google.maps.event.addListener(c_43, 'click', function() {a_43.open(mapa, c_43);});
  13.  
  14. var a_42 = new google.maps.InfoWindow ({content: '<p><span class="title">test4</span>,<br /><br />4</p>'});
  15. var b_42 = new google.maps.LatLng(51.76191289573248, 19.447795124359118);
  16. var c_42 = new google.maps.Marker({position: b_42, map: mapa, icon: flaga});
  17. google.maps.event.addListener(c_42, 'click', function() {a_42.open(mapa, c_42);});
  18.  
  19. var a_41 = new google.maps.InfoWindow ({content: '<p><span class="title">test3</span>,<br /><br />3</p>'});
  20. var b_41 = new google.maps.LatLng(51.757344065590104, 19.449125500030505);
  21. var c_41 = new google.maps.Marker({position: b_41, map: mapa, icon: flaga});
  22. google.maps.event.addListener(c_41, 'click', function() {a_41.open(mapa, c_41);});
  23.  
  24. var a_40 = new google.maps.InfoWindow ({content: '<p><span class="title">test2</span>,<br /><br />2</p>'});
  25. var b_40 = new google.maps.LatLng(51.76042542039522, 19.47418806106566);
  26. var c_40 = new google.maps.Marker({position: b_40, map: mapa, icon: flaga});
  27. google.maps.event.addListener(c_40, 'click', function() {a_40.open(mapa, c_40);});
  28.  
  29. var a_39 = new google.maps.InfoWindow ({content: '<p><span class="title">test1</span>,<br /><br />1</p>'});
  30. var b_39 = new google.maps.LatLng(51.7574503227045, 19.473801822967516);
  31. var c_39 = new google.maps.Marker({position: b_39, map: mapa, icon: flaga});
  32. google.maps.event.addListener(c_39, 'click', function() {a_39.open(mapa, c_39);});
  33.  
  34. }


na mapie mam ładnie pokazane markery z opisami pojawiającymi się w dymkach po kliknięciu na nie, następnie w sekcji BODY tworze w pętli linki

  1. <ol>
  2. <li><strong><a href="java script:google.maps.event.addListener(d_43, 'click', function() {b_43.open(mapa, d_43);});">test5</a></strong> (5)</li>
  3. <li><strong><a href="java script:google.maps.event.addListener(d_42, 'click', function() {b_42.open(mapa, d_42);});">test4</a></strong> (4)</li>
  4. <li><strong><a href="java script:google.maps.event.addListener(d_41, 'click', function() {b_41.open(mapa, d_41);});">test3</a></strong> (3)</li>
  5. <li><strong><a href="java script:google.maps.event.addListener(d_40, 'click', function() {b_40.open(mapa, d_40);});">test2</a></strong> (2)</li>
  6. <li><strong><a href="java script:google.maps.event.addListener(d_39, 'click', function() {b_39.open(mapa, d_39);});">test1</a></strong> (1)</li>
  7. </ol>


mam prośbę o podpowiedź co wstawić w HREF aby wyświetlić dany marker na mapie?

Ten post edytował piotrd 8.08.2012, 13:07:49
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 23:31