HTML
  Home arrow HTML arrow Clickable Geographical Map Regions
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  
Mobile Linux 
App Generation ROI 
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? 
HTML

Clickable Geographical Map Regions
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-06-03

    Table of Contents:
  • Clickable Geographical Map Regions
  • Relationship between Geographical Regions and Image-Maps
  • Code Explained
  • Caution, Animation, Conclusion

  • 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


    Clickable Geographical Map Regions


    (Page 1 of 4 )

    When your site has web pages with geographical maps, sometimes it is nice to make the regions of the map clickable. Imagine that you have a political map of Western Europe. It would be nice to make the countries clickable, so that when a user clicks a country, he would go to a page that has political information (e.g. history) about the country. We can use HTML image-maps to achieve this, but the shapes of countries are irregular. How can we turn an irregular shape into a clickable region? Keep reading.

    Let me first briefly explain what an HTML image-map is.

    HTML Image-Map

    An image-map is an image with clickable regions. Three HTML elements are used to create image maps. They are the IMG element, the MAP element, and the AREA element. Consider the following hypothetical example:


    <img src ="image.gif" usemap ="#ID" />

    <map id ="ID">

    <area shape = "rect" coords ="0,0,82,126" href ="details.htm" alt="Click for details" />

    <area shape ="circle" coords ="90,58,3" href ="details.htm" alt="Click for details" />

    <area shape = "poly" coords ="21,317,19,323,21,329" href ="details.htm" alt="Click for details" />

    </map>


    First you have the IMG tag. In this tag there has to be a usemap attribute, which provides the connection between the IMG tag and the MAP tag. Its value is the ID of the MAP element preceded by the # symbol. Next you have the MAP element, which has a start and end tag. This element must have an ID whose value must be the same as the usemap value, but without the # symbol. The content of the MAP element is the AREA elements. Each area has a shape attribute and a coordinates attribute.

    The shape describes the clickable regions and it can be a rectangle, circle, or a polygon. If it is a rectangle then the first two coordinates are the coordinates of the left-top corner of the rectangle and the last two coordinates are the coordinates of the right-bottom corner of the rectangle. If it is a circle, then the first two coordinates are the coordinates of the center of the circle and the last coordinate (value) is the radius of the circle. If it is a polygon then the coordinates are in consecutive pairs, and each pair represents the coordinates of a vertex of the polygon.

    These coordinates are measured with reference to the left-top corner of the image and not the left-top corner of the web page. If you want a region to result in a new web page after clicking, then you need to give the AREA element an href attribute. You can also give the AREA element an ALT attribute so that when the user's mouse pointer hovers over it, a tool tip appears, indicating what the user will see after clicking.

    More HTML Articles
    More By Chrysanthus Forcha


       · A secret to make irregular image shapes clickable.A secret to give links to...
     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






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