Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]missing ) after argument list, wyznaczanie trasy w google API
zolasty
post
Post #1





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 2.07.2009

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


Fire bug wyrzuca mi taki błąd:
missing ) after argument list
[Break on this error] var adres = document.getElementById(''adres'').value; \n
Ale ja nie mogę dostrzec błędu (IMG:style_emoticons/default/sadsmiley02.gif)


[JAVASCRIPT] pobierz, plaintext
  1. var mapa;
  2. var punkt;
  3. function mapaStart()
  4. {
  5. if (GBrowserIsCompatible()) {
  6. mapa = new GMap2(document.getElementById("mapa"));
  7. punkt = new GLatLng(51.2374705,22.5245905);
  8. mapa.setCenter(punkt,14);
  9. mapa.setUIToDefault();
  10. }
  11. }
  12. function obliczOdleglosc()
  13. {
  14. var adres = document.getElementById(''adres'').value;
  15. var trasa = new GDirections(mapa);
  16. GEvent.addListener(trasa, "load", function () {
  17. var dystans = trasa.getDistance().meters/1000;
  18. var wynik = document.getElementById(''wynik'');
  19. wynik.innerHTML = ''Odległość: '' + Math.round(dystans) + ''km'';
  20. });
  21. trasa.load("from: "+punkt+" to: "+adres);
  22. }
[JAVASCRIPT] pobierz, plaintext

  1. <body onload="pokazMape()" onunload="GUnload()">
  2.  
  3. <form action="" onsubmit="obliczOdleglosc(); return false;">
  4. <b>Adres: </b>
  5. <input type="text" id="adres" value="" />
  6. <input type="submit" value="Oblicz odległość" />
  7. </form>
  8. <div style="color: red;" id="wynik"></div>
  9.  
  10. <div id="mapa" style="width: 500px; height: 400px;"><!-- miejsce na mapkę --></div>
  11. </body>
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: 1.10.2025 - 10:34