Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript] brak konstruktora
rybosom
post
Post #1





Grupa: Zarejestrowani
Postów: 82
Pomógł: 0
Dołączył: 6.09.2004

Ostrzeżenie: (20%)
X----


od wczoraj przestało mi działać na stronie wyświetlanie mapy Google sad.gif

Cytat
TypeError: google.maps.LatLng is not a constructor - mapa.htm:8
TypeError: google.maps.Map is not a constructor - mapa.htm:19


błąd w linii 8
  1. var pozycja = new google.maps.LatLng(49.75508, 19.11067);
błąd w linii 19
  1. mapa = new google.maps.Map(document.getElementById("mapa"), opcje);


źródło strony:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="pl-PL" lang="pl-PL">
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  4. <title>mapa</title>
  5. <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. var pozycja = new google.maps.LatLng(49.75508, 19.11067);
  9. var opcje = {zoom: 14, center: pozycja, mapTypeId: google.maps.MapTypeId.ROADMAP}
  10. var marker = new google.maps.Marker({position: pozycja, draggable: true});
  11. var dymek = new google.maps.InfoWindow();
  12. var mapa;
  13.  
  14. function abc() {
  15. mapa = new google.maps.Map(document.getElementById("mapa"), opcje);
  16. google.maps.event.addListener(mapa, 'click', function(event) {
  17. if(event.latLng) {
  18. dymek.setContent('pozycja');
  19. dymek.setPosition(event.latLng);
  20. dymek.open(mapa);
  21. }
  22. document.getElementById('_lng').value = event.latLng.lng();
  23. document.getElementById('_lat').value = event.latLng.lat();
  24. });
  25. google.maps.event.addListener(marker, 'dragend', function(mark) {
  26. document.getElementById('_lng').value = mark.latLng.lng();
  27. document.getElementById('_lat').value = mark.latLng.lat();
  28. });
  29. mapa.setCenter(marker.position);
  30. marker.setMap(mapa);
  31. }
  32. //]]>
  33. </head>
  34.  
  35. <body onload="abc();">
  36. <div id="mapa"></div>
  37. </body>
  38. </html>


niczego nie zmianiałem od miesięcy - domyślam się, że Google zmieniło coś w API. Pomoże ktoś dojść do rozwiązania problemu?

edit: problem jak się okazało był na ruterze - zablokowana strona gstatic.com smile.gif

Ten post edytował rybosom 30.04.2014, 09:39:28
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 21.08.2025 - 08:20