To start with, you need to create a new AJAX enabled web
site from inside Visual Studio 2005. Creating a new website based on this
template makes sure that the website is properly configured to run with AJAX. If you have any problems in creating such a website, please make sure you check one
of the last two articles about AJAX that included a detailed section on how to
create such a website.
Add a new ASPX page and add the following HTML tags:
Listing 1
<map name="ImageMap">
<area shape="rect" alt="" coords="0,0,85,20"
onmouseover="javascript:GetAreaInfo(event, 'Lebanon');"
onmouseout="javascript:HidePopup();" />
<area shape="rect" alt="" coords="135,60,185,75"
onmouseover="javascript:GetAreaInfo(event, 'Tripoli');"
onmouseout="javascript:HidePopup();" />
<area shape="rect" alt="" coords="120,105,160,120"
onmouseover="javascript:GetAreaInfo(event, 'Byblos');"
onmouseout="javascript:HidePopup();" />
<area shape="rect" alt="" coords="93,140,140,160"
onmouseover="javascript:GetAreaInfo(event, 'Beirut');"
onmouseout="javascript:HidePopup();" />
<area shape="rect" alt="" coords="70,240,105,260"
onmouseover="javascript:GetAreaInfo(event, 'Tyre');"
onmouseout="javascript:HidePopup();" />
<area shape="rect" alt="" coords="140,175,205,190"
onmouseover="javascript:GetAreaInfo(event, 'Beiteddine');"
onmouseout="javascript:HidePopup();" />
<area shape="rect" alt="" coords="200,85,245,100"
onmouseover="javascript:GetAreaInfo(event, 'Bcharre');"
onmouseout="javascript:HidePopup();" />
<area shape="rect" alt="" coords="180,155,225,165"
onmouseover="javascript:GetAreaInfo(event, 'Zahle');"
onmouseout="javascript:HidePopup();" />
<area shape="rect" alt="" coords="220,120,270,140"
onmouseover="javascript:GetAreaInfo(event, 'Ballbak');"
onmouseout="javascript:HidePopup();" />
</map>
<img src="images/lebanon.gif" border="0" alt="" usemap="#ImageMap" />
What we have done in the above HTML tags is added a new
image with several hot spots representing the major cities in Lebanon. If you notice, each hot spot has a onmouseover and onmouseout JavaScript functions calls.
We will discuss these functions in a later section in this article. For the
time being just note that each hot spot will fire some JavaScript functions
whenever you place your mouse over the area or when you remove your mouse.