Global GuideLine Home HTML Tutorial JavaScript Tutorial SQL Tutorial CSS Tutorial SEO Tutorial XML Tutorial XSLT Tutorial Articles Tutorial Interview Questions and Answers Guide Jobs GuideLine Bookmark With Google Bookmark With Yahoo Bookmark With FaceBook Bookmark With Live Follow @GlobalGuideLine on Twitter Bookmark Global GuideLine
JavaScript in Mapping, JavaScript Tutorial, Global Guide Line Technology.
Bookmark this webpage. Bookmark: JavaScript in Mapping, JavaScript Tutorial Global Guideline is UNITED STATES's favorite website

      Home                    

Basic JavaScript Guide.
 JScript Introduction.            
 JScript Why?                       
 JScript Recognitions.          
 JScript onMouseover.         
 JScript with Buttons.           
 JScript Alerts.                     
 JScript Variables.               
 JScript Operators.               
 JScript Functions.               
 JScript Prompts.                 
 JScript Conditions.             
 JScript Validations.            
 JScript Confirmation Boxes.
 JScript Browser Detection.  
 JScript Redirection.            
 JScript on Links.                 
 JScript Switch.                    
 JScript Loops.                     
 JScript Events.                    
 JScript Exception Handling.
 JScript Reserve Characters. 
 JScript with Objects.            
 JScript Math Object.           
 JScript using Dates.             
 JScript using String.            
 JScript using Arrays.            
 JScript Operations.              
 JScript Handling Cookies.   
 JScript in Mapping.
 JScript Time Out.                
 JScript Summary.                

Learn JavaScript with Examples
Learn JavaScript with hundred of short examples with code and output.
Complete_JScript_Examples.php

JScript Interview Questions & Answers
Learn JavaScript by thousands of Interview Questions & Answers.
JavaScriptQuestions/index.php

JavaScript Tutorial >> JavaScript in Mapping.


     Back             Next     





Here in JavaScript Tutorial we will learn how image maps work in JavaScript, then how they are created and what they're used for in our real life.

What is image map?

In an image mapping one image is used and multiple of clickable areas we define this technique is called image maps, now we will grip how to handle it with JavaScript.

Shapes used in JavaScript image map.

There are three different shapes used in image map first is "Rect" second is "Circ" and third is "poly".
rect: It is short for rectangle. We'll need two different co-ordinates Top right and bottom left.
For example: shape ="rect" cords ="0,0,10,10"
Circ: It is the easiest of all. All we need is the centre co-ordinate the point in the centre of our shape and it's radius size.
For example: shape ="circ" cords ="30,100,10"
Poly: It is used for the polygon. So if we are going to have a pentagon, then we list all five co-ordinates. All co-ordinates should have listed in order.
For example: shape ="poly" cords ="40,50,55,60,70,80,85,90,145,126"  

JavaScript Image mapping Example

In Image mapping we can add events that can call a JavaScript Events to the <area> tags inside the image map. The <area> tag supports the onClick, onDblClick, onMouseDown, onMouseUp, onMouseOver, onMouseMove, onMouseOut, onKeyPress, onKeyDown, onKeyUp, onFocus, and onBlur events.
We use only onMouseOver event here to explain how to use JavaScript with image mapping.

<html>
<head>
<title>JavaScript Tutorial, Image mapping with JavaScript</title>
<script type="text/javascript">
 function details(txt)
 {
  document.getElementById("description").innerHTML=txt
 }
</script>
</head>
<body>
  <map name="myApplesMapping">
    <area href="" shape="circle" coords="139, 130, 48"
    onmouseover="details('Red Apple')">
    <area href="" shape="circle" coords="88, 55, 47"
    onmouseover="details('Green Apple')">
    <area href="" shape="circle" coords="48, 137, 48"
    onmouseover="details('Yellow Apple')">
  </map>

  <img src ="Apples.gif" alt="Put your mouse over any apple" width ="198"
  height ="202" usemap="#myApplesMapping" /></p>
  <br>
  <p id="description"></p>
</body>
</html>

Out put of JavaScript Image mapping example.

Put your mouse over any apple now.
Put your mouse over any apple




     Back             Next     
 

JavaScript Image Object Examples



In order to link this page as Reference, click on below text area and pres (CTRL-C) to copy the code in clipboard or pres right click then copy the following lines after that past into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code:

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright © 2005-2006 www.globalguideline.com All rights reserved. Join Global Guide Line community. 340 visitors are online now