HTML
  Home arrow HTML arrow Page 2 - Another Look at Animation of Geographical ...
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

Another Look at Animation of Geographical Map Regions
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-06-23

    Table of Contents:
  • Another Look at Animation of Geographical Map Regions
  • How to Stop the Blinking
  • Complete Code
  • Code continued
  • More Code

  • 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


    Another Look at Animation of Geographical Map Regions - How to Stop the Blinking


    (Page 2 of 5 )


    We need to stop the blinking as the mouse pointer goes out of the region of Portugal, Spain, or France. Here's how: this fourth region forms an AREA element for each of the image maps. As soon as the mouse pointer is over this fourth region, the fourth AREA element triggers an onmouseover event. A function is called that stops any blinking that was taking place for the region of Portugal, Spain, or France.

    As you can see, we have avoided the use of the onmouseout event. We have avoided the "intermittent" problems that it brings with the browser. We have simulated it with the presence of the fourth region. We still have another problem to handle, though: the recurring of the onmouseover event while the mouse pointer remains over an element.

    As long as the mouse pointer is over Portugal, the onmouseover event will be recurring, but we only have to respect it the first time it occurs. So when the mouse pointer goes over Portugal, the onmouseover event of the AREA element of Portugal is triggered. It calls a function with the name "startTogglingPortugal()." This function has two purposes: it calls the "togglingPortugal()" function, which actually toggles the initial image with the image that has a blue color for Portugal. The other purpose of the "startTogglingPortugal()" function is to guard the program against the recurrences of the onmouseover event while the mouse pointer is over Portugal, meaning it has to make the program ignore any subsequent recurrence of the onmouseover event.

    It does this by using the "mouseHasBeenOverOnceP" global variable. This is initialized at the global level to zero. When the onmouseover event occurs the first time, the value of this variable is increased to 1; the second time the onmouseover event occurs, the value of the variable is increased to 2; the third time, the value is increased to 3, and so on. The "startTogglingPortugal()" function is written so that it calls the "togglingPortugal()" function only when the "mouseHasBeenOverOnceP" is 1. This way, the recurrences of the mouse event are ignored.

    So the onmouseover event has two corresponding functions, "startTogglingPortugal()" and "togglingPortugal()." Both Spain and France have similar corresponding functions.

    The "togglingPortugal()" function uses a DOM timing function. The syntax for the JavaScript timing function is:


    var t = setTimeout("javascript statement",milliseconds)


    The last parameter (milliseconds) is time in milliseconds. The first parameter is a statement, or call, to a function that is executed after the time indicated in the last parameter (milliseconds) has elapsed. If you want the statement to be repeatedly executed after a specified time interval, you have to put the "setTimeout" function in a while loop. The "setTimeout" function returns a value (t). You can cancel (nullify) the "setTimeout" function using the following function:


    clearTimeout(t)


    Here, t is the return value of the "setTimeout" function. This statement can be executed even if the "setTimeout" function has not been called. If you cancel the "setTimeout" function while the While loop is on, then you still have to stop the while loop. However, I use a different technique. Consider the following function:


    function togglingPortugal()

    {

    ............

    ............

    ............


    t = setTimeout("togglingPortugal()",500);

    }


    The "setTimeout" function is inside a function called "togglingPortugal()." The first parameter in the "setTimeout" function is a call to "togglingPortugal()." So, "togglingPortugal()" calls itself (in the "setTimeout" function). With this, you automatically have a While loop centered at the "setTimeout" function. So, to stop the timing effect at the same time as the while loop, all you need to do is execute the following statement:


    clearTimeout(t)

    More HTML Articles
    More By Chrysanthus Forcha


       · At last, you too can also do it.Chrys
       · Please give one tip for <div> with table in ie browesr
     

    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 5 hosted by Hostway
    Stay green...Green IT