JavaScript
  Home arrow JavaScript arrow Page 2 - Creating Click Loggers and Basic Markers w...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Creating Click Loggers and Basic Markers with Yahoo! Maps
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-04-22

    Table of Contents:
  • Creating Click Loggers and Basic Markers with Yahoo! Maps
  • Review: adding zoom and pan control to a single Yahoo! Map
  • Building a click logger within a map’s area
  • Adding basic markers on the fly

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating Click Loggers and Basic Markers with Yahoo! Maps - Review: adding zoom and pan control to a single Yahoo! Map


    (Page 2 of 4 )

    Before I show you how to create an efficient click detection mechanism for a selected Yahoo! Map, I’d like to review the “addPanControl()” method that you learned in the last article. This came in handy when adding an effective panoramic control to a specified map.

    That being said, examine the following code sample, which, as I said before, demonstrates how to incorporate a pan control to a targeted Yahoo! Map:


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <title>Example on building a YAHOO! Map with pan and short zoom controls</title>

    <script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?
    v=3.7&appid=Your-AP-ID"></script>

    <style type="text/css">

    body{

    padding: 0;

    margin: 0;

    background: #fff;

    }

    h1{

    font: bold 16pt Arial, Helvetica, sans-serif;

    color: #000;

    text-align: center;

    }

    #mapcontainer{

    height: 400px;

    width: 500px;

    margin-left: auto;

    margin-right: auto;

    }

    </style>

    </head>

    <body>

    <h1>Example on building a YAHOO! Map with pan and short zoom controls</h1>

    <div id="mapcontainer"></div>

    <script type="text/javascript">

    // Create a new map object

    var map=new YMap(document.getElementById('mapcontainer'));

    // Add type controls to the map

    map.addTypeControl();

    // Add the Pan Control to the map

    map.addPanControl();

    // Add short zoom control to the map

    map.addZoomShort();

    // Set map type to YAHOO_MAP_SAT

    map.setMapType(YAHOO_MAP_SAT);

    // Display the map centered on the selected location

    map.drawZoomAndCenter("Los Angeles",3);

    </script>

    </body>

    </html>


    After analyzing the above example, I will assume that including a pan control into an existing Yahoo! Map is a familiar process, since it only requires using the “addPanControl()” method, which belongs to the pertinent “YMap” JavaScript class that was introduced in earlier articles of this series.

    At this stage, I've shown you how to construct maps that are pretty interactive, because they include some additional controls, like the zoom and pan mechanisms. However, any decent geographical mapping application should also incorporate the ability to add basic markers to a map when clicking on it. And certainly the Yahoo! Maps framework is no exception, since it permits you to work with basic and “smart” markers at the same time.

    Actually I’m getting ahead of myself. Thus, in the upcoming section, I’m going to teach you how to create an effective click detection mechanism that will come in handy when adding markers to a given Yahoo! Map.

    To see how this will be achieved, please click on the link shown below and keep reading.

    More JavaScript Articles
    More By Alejandro Gervasio


       · In this fourth article of the series, you’ll learn in detail how to include some...
     

    JAVASCRIPT ARTICLES

    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...
    - Dynamically Generate a Selection List in a R...
    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT