Cibiņš Posted September 18, 2011 Report Share Posted September 18, 2011 (edited) Sveicināti kolēģi! Šeit jau bez pamatojuma nelienu un nebļauju, bet nu, šoreiz kārtējā, laikam jau iesācēju, problēma :D Man ir 3 faili, kuri veido google maps marķierus. index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="http://maps.google.com/maps?file=api&v=2" type="text/javascript"></script> <script src="map_data.php" type="text/javascript"></script> <script src="map_functions.js" type="text/javascript"></script> </head> <body> <div id="map" style="width: 700px; height: 700px;"></div> </body> </html> map_functions.js var map; var centerLatitude = 37.818361; var centerLongitude = -122.478032; var startZoom = 13; function addMarker(longitude, latitude, description) { var marker = new GMarker(new GLatLng(latitude, longitude)); GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(description); } ); map.addOverlay(marker); } function init() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom); for(id in markers) { addMarker(markers[id].latitude, markers[id].longitude, markers[id].name); } } } window.onload = init; window.onunload = GUnload; un map_data.php var markers = [ { 'latitude': 37.818361, 'longitude': -122.478032, 'name': 'Zelta vārtu tilts' }, { 'latitude': 40.6897, 'longitude': -74.0446, 'name': 'Brīvības statuja' }, { 'latitude': 38.889166, 'longitude': -77.035307, 'name': 'Vašingtona monuments' } ]; Piesaistot map_data.php un map_functions.php pie index.php rodas kosmisks rezultāts - šie objekti atrodas kaut kur Antarktīdā. Vai tiešām pamazām notiek pasaules gals, ka šie objekti kaut kur pārvietojušies? :D Vai arī esmu kaut kur ielaidis kārtējo kļūdu.. Edited September 18, 2011 by Cibiņš Quote Link to comment Share on other sites More sharing options...
Kaklz Posted September 18, 2011 Report Share Posted September 18, 2011 Tu vienkārši padod parametrus nepareizā secībā. Apskaties addMarker definīciju function addMarker(longitude, latitude, description) { un kā tu padod datus addMarker(markers[id].latitude, markers[id].longitude, markers[id].name); redzi atšķirību? Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted September 19, 2011 Author Report Share Posted September 19, 2011 Njā šo neievēroju. Viss bumbās. Tad nav nekāds pasaules gals un objekti nav pārvietojušies :D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.