tailieunhanh - Beginning Google Maps Applications with PHP and Ajax From Novice to Professional PHẦN 7

và bạn không cần phải bấm vào OK trong hàng chục cửa sổ cảnh báo để có được 9-2. GLog cửa sổ liệt kê các phương pháp và tài sản của đối tượng GMap2 () phương pháp thoát khỏi bất kỳ HTML và đăng nhập vào cửa sổ mã nguồn. Nếu bạn muốn đầu ra định dạng HTML, | 210 CHAPTER 9 ADVANCED TIPS AND TRICKS For example if you re curious about what methods and properties a JavaScript object has such as the GMap2 object try this var map new GMap2 map for i in map i Voilà The GLog window in Figure 9-2 now contains a scrolling list of all the methods and properties belonging to your GMap2 object and you didn t need to click OK in dozens of alert windows to get to it. Figure 9-2. GLog window listing methods and properties of the GMap2 object The method escapes any HTML and logs it to the window as source code. If you want to output formatted HTML you can use the method. Similarly to output a clickable link just pass a URL into the method. The writeUrl method is especially useful when creating your own map tiles as you ll see in the Implementing Your Own Map Type Tiles and Projection section later in the chapter where you can simply log the URL and click the link to go directly to an image for testing. rip GLog isn t bound to just map objects it can be used throughout your web application to debug any JavaScript code you want. As long as the Google Maps API is included in your page you can use GLog to help debug anything from Ajax requests to mouse events. Interacting with the Map from the API When building your web applications using Google Maps you ll probably have more in your application than just the map. What s outside the map will vary depending on the purpose of your project and could include anything from graphical eye candy to interactive form elements. When these external elements interact with the map especially when using the mouse you may often find yourself struggling to locate the pixel position of the various map objects on your screen. You may also run into situations where you need to trigger events even mouse-related events without the cursor ever touching the element. In these situations a few classes and methods may come in handy. CHAPTER 9