tailieunhanh - Beginning Google Maps Applications with PHP and Ajax From Novice to Professional PHẦN 5
Nếu không có nhà nước tải được hiển thị, người dùng có thể giả định họ đã không thực sự nhấp vào nút hoặc sẽ trở thành thất vọng và nghĩ rằng không có gì đang xảy cửa sổ GLog trong hình 9-2 chứa một danh sách di chuyển của tất cả các phương pháp và tài sản thuộc đối tượng GMap2 của bạn, | 132 CHAPTER 6 IMPROVING THE USER INTERFACE Note It s incorrect HTML to have a ul element that doesn t contain any children. In our case however we know that as soon as the map loads there will be elements added to this list so it s another standards gray area. If having it empty troubles you you could put in a dummy li node and then start your JavaScript out by removing this node. But of course there would still be a moment in time where the ul is empty which is why doing anything more than what we ve got here feels a little silly. Obviously the current iteration of provides only latitude longitude and a text label. The side panel will be much more useful if it can display supplementary information rather than just the same thing with different formatting. Let s arbitrarily pick a handful more fields from the fcc_towers view and add them to the output as shown in Listing 6-13. Listing 6-13. An Updated Output Section var markers php while row mysql_fetch_assoc result joiner latitude row latitude longitude row longitude address addslashes row struc_address city addslashes row struc_city state addslashes row struc_state height addslashes row struc_height elevation addslashes row struc_elevation type addslashes row struc_type owner addslashes row owner_name joiner count php endwhile Now we re ready to step back in JavaScript. Regarding how to actually add these items to the side panel list there are a number of different schools of thought. The strictest camps would argue for using only XML DOM methods. This would mean creating each tag ahem element with createElement putting text inside it using createTextNode and then adding it to the list with appendChild. To use this method is to respect the sanctity of the HTML document tree as an abstract XML data structure in memory. In contrast using the innerHTML property lets us inject blobs of already marked-up content unvalidated content which may or may not keep the document correct. Our method .
đang nạp các trang xem trước