TAILIEUCHUNG - Beginning Ajax with PHP From Novice to Professional P8

Tiếp theo bạn có chức năng khởi tạo kịch bản của bạn. Đây là chức năng mà bạn gọi là trong sự kiện onload trong . Ở đây bạn thiết lập các yếu tố đó sẽ giữ cho Google bản đồ và thông báo trạng thái của bạn. Sau này đã được thiết lập, bạn gọi loadMap, hiển thị bản đồ dựa trên các cài đặt | CHAPTER 10 SPATIALLY ENABLED WEB APPLICATIONS 167 Next you have your script initialization function. This is the function you called in the onload event in . Here you set the elements that will hold your Google map and your status message. After this has been set you call loadMap which displays the map based on your settings and loads your various points. We will look at this function more closely shortly function init mapId msgId mapContainer mapId msgContainer msgId loadMap The next function you define is a handy little function that creates a marker for your Google map. This doesn t actually add the marker to the map you create the point using this function then add it later on. The first parameter to this function is the map point which you also create elsewhere based on a location s latitude and longitude. The second parameter contains the HTML you will display inside the pop-up window. function createInfoMarker point theaddy var marker new GMarker point marker click function theaddy return marker This next function is the core function behind generating your Google map. You first create your map using the GMap class provided by the Google JavaScript file you included earlier and then you add some features to the map the zoom control and ability to change the map type . You then center your map on the coordinates defined previously. Next you use Ajax to load the locations from your database. Here you are using Google s code to generate your XMLHttpRequest object just for the sake of completeness. You then define your onreadystatechange function as in previous examples. This function uses the returned XML from your file. You use the built-in JavaScript functions for handling XML to read each row creating a point using Google s GPoint class and defining the marker HTML. You then call your createInfoMarker function to generate a marker that you

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.