Google map Google map o var initial Location

  • Slides: 11
Download presentation

Google map

Google map

Google map嵌入 o var initial. Location; var siberia = new google. maps. Lat. Lng(60,

Google map嵌入 o var initial. Location; var siberia = new google. maps. Lat. Lng(60, 105); var newyork = new google. maps. Lat. Lng(40. 69847032728747, 73. 9514422416687); var browser. Support. Flag = new Boolean(); function initialize() { var my. Options = { zoom: 6, map. Type. Id: google. maps. Map. Type. Id. ROADMAP }; var map = new google. maps. Map(document. get. Element. By. Id("map_ca nvas"), my. Options);

Google map嵌入 o // Try W 3 C Geolocation (Preferred) if(navigator. geolocation) { browser.

Google map嵌入 o // Try W 3 C Geolocation (Preferred) if(navigator. geolocation) { browser. Support. Flag = true; navigator. geolocation. get. Current. Position(function(position) { initial. Location = new google. maps. Lat. Lng(position. coords. latitude, position. coords. longit ude); map. set. Center(initial. Location); }, function() { handle. No. Geolocation(browser. Support. Flag); }); // Try Google Gears Geolocation } else if (google. gears) { browser. Support. Flag = true; var geo = google. gears. factory. create('beta. geolocation'); geo. get. Current. Position(function(position) { initial. Location = new google. maps. Lat. Lng(position. latitude, position. longitude); map. set. Center(initial. Location); },

Google map嵌入 o function() { handle. No. Geo. Location(browser. Support. Flag); }); // Browser

Google map嵌入 o function() { handle. No. Geo. Location(browser. Support. Flag); }); // Browser doesn't support Geolocation } else { browser. Support. Flag = false; handle. No. Geolocation(browser. Support. Flag); } function handle. No. Geolocation(error. Flag) { if (error. Flag == true) { alert("Geolocation service failed. "); initial. Location = newyork; } else { alert("Your browser doesn't support geolocation. We've placed you in Siberia. "); initial. Location = siberia; } map. set. Center(initial. Location); } }