Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [js]google map api
Forum PHP.pl > Forum > Przedszkole
gigzorr
Witam.Moze ktos mial podobny problem z google mapami , jak dodaje jakas funkcje to nastepna przestaje dzialac , jak dodawalem pierwsze to bylko ok , gdzies po 3 cos jest nie tak , jakby czegos brakowalo , zeby obslugiwalo kolejne , teraz jest tak , ze jak dodam nowa , to reszta nie dziala , a jak usune to dziala snitch.gif , moze ktos sie z tym spotkal?;p

przykładowy skrypt:
  1. GEvent.addListener(map, "click", function(overlay, latlng) {
  2. if (latlng) {
  3. marker = new GMarker(latlng, {draggable:true});
  4. GEvent.addListener(marker, "click", function() {
  5. var html = "<table>" +
  6. "<tr><td>Name:</td> <td><input type='text' id='name'/> </td> </tr>" +
  7. "<tr><td>Address:</td> <td><input type='text' id='address'/></td> </tr>" +
  8. "<tr><td>Type:</td> <td><select id='type'>" +
  9. "<option value='bar' SELECTED>bar</option>" +
  10. "<option value='restaurant'>restaurant</option>" +
  11. "</select> </td></tr>" +
  12. "<tr><td></td><td><input type='button' value='Save & Close' onclick='saveData()'/></td></tr>";
  13.  
  14. marker.openInfoWindow(html);
  15. });
  16. map.addOverlay(marker);
  17. }
  18. });
  19.  
  20.  
  21.  
  22. function saveData() {
  23. var name = escape(document.getElementById("name").value);
  24. var address = escape(document.getElementById("address").value);
  25. var type = document.getElementById("type").value;
  26. var latlng = marker.getLatLng();
  27. var lat = latlng.lat();
  28. var lng = latlng.lng();
  29.  
  30. var url = "phpsqlinfo_addrow.php?name=" + name + "&address=" + address +
  31. "&type=" + type + "&lat=" + lat + "&lng=" + lng;
  32. GDownloadUrl(url, function(data, responseCode) {
  33. if (responseCode == 200 && data.length <= 1) {
  34. marker.closeInfoWindow();
  35. document.getElementById("message").innerHTML = "Location added.";
  36. }
  37. });
  38. }
  39.  
  40.  
  41.  


Po dodaniu tego do skryptu , ta funkcja dziala , reszta nie snitch.gif
erix
Może wypuść gdzieś to na żywo...?
gigzorr
hmmm

prosze

Teraz jest wlasnie , ze ta ostatnia dziala co dalem najwyzej , a reszta nie , ta funkcja dodaje punkty na mape poprzez lewe klikniecie myszka , ale reszta nie dziala , np. wybor z listy, wyszukiwarka etc.
thek
Włącz i używaj Firebuga. U mnie walnęło po wejściu:
document.getElementById(id) is null
for (var i = 0; i < document.getEleme...ElementsByTagName('dt').length; i++)
menu.js (wiersz 38)

Popatrzyłem i się pytam, czy wiesz co masz w tym -> document.getElementById(id).getElementsByTagName('dt').length bo to jest teraz problem smile.gif Czemu to sypie nullem, chodź powinno wskazywać na określony element.
gigzorr
hm mój post się sam tutaj skasował ?
thek to, to jest od menu , ktore robilem na to nie zwracaj uwagi smile.gif
coś ci się pomyliło ;p
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.