tailieunhanh - Beginning Google Maps Applications with PHP and Ajax From Novice to Professional PHẦN 2
alert ('tiến trình đáp ứng');}} Nếu bạn chạy các kịch bản hơn và hơn, đôi khi hộp thoại cảnh báo sẽ xuất hiện trong quá trình để đáp ứng sau đó tiếp tục, nhưng nhiều khả năng, bạn sẽ nhận được Tiếp tục sau đó yêu cầu quá trình. Chỉ cần nhớ rằng nếu bạn muốn một cái gì đó xảy ra sau khi phản hồi, | CHAPTER 2 GETTING STARTED 15 Examining the Sample Map Once you have the file in Listing 2-1 uploaded to your webspace check it out in a browser. And ta-da a map in action Listing 2-1. The Google Maps API Starter Code DOCTYPE html PUBLIC - W3C DTD XHTML Strict ZEN http TR xhtml1 DTD html xmlns http 1999 xhtml head meta http-equiv content-type content text html charset utf-8 title Google Maps JavaScript API Example title script src http maps file api amp v 2 amp key ABQIAAAA 33EjxkLYsh9SEVeh_MphphQP1yR2bHJW2Brl_bW_l0KXsyt8cxTKO5Zz-UKoJ6Ie pTlZRxN8nfTRgw type text javascript script script type text javascript CDATA function load if GBrowserIsCompatible var map new GMap2 map new GLatLng 13 script head body onload load onunload GUnload div id map style width 500px height 300px div body html In Listing 2-1 the container holding the map is a standard XHTML web page. Alot of the listing here is just boilerplate standard initialization instructions for the browser. However there are three important elements to consider. First the head of the document contains a critical script element. Its src attribute points to the location of the API on Google s server and your key is passed as a parameter script src http maps file api amp v 2 amp key YOUR_KEY_HERE -type text javascript script Second the body section of the document contains a div called map div id map style width 500px height 300px div 16 CHAPTER 2 GETTING STARTED Although it appears empty this is the element in which the map will sit. Currently a style attribute gives it a fixed size however it could just as easily be set it to a dynamic size such as width 50 . Finally back in the head there s a script element containing a short JavaScript which is triggered by the document body s onload event. It s this code that communicates with Google s API and actually sets up the map. function load .
đang nạp các trang xem trước