CFX_MapClickv1.0August 2004© Claude Schnéegans |
|---|
CFX_MapClick can then replace a complex set of AREA tags in a link on a GIF image with the attribute USEMAP set. If the coordinates of a click on the image is passed in X and Y attributes, then the color and the color index of the area clicked. If the image is correctly defined, using one and only one color per area, and if the color index of each area is stored in a database, then it is easy to associate any data with the area clicked by the user (see example below).
To use this tag, you need to take the included mapClick.dll, install it on a drive on your server and make it known to the ColdFusion administrator.
You do this by going to the "CFX Tags" tab in the administrator,
That's it!
For more information refer to the ColdFusion documentation "Managing CFXs".
<CFX_MapClick IMAGEFILE = <full path name of the image file"> [X] = <abscise of the pixel> [Y] = <ordinate of the pixel> >
| TAG | ATTRIBUTE | CONTENT | REQUIRED | DEFAULT |
|---|---|---|---|---|
| <CFX_MapClick | IMAGEFILE= | Full path name of the image file on the server. The file must have an extension GIF, JPG, JPE, JPEG or PNG, and must be of one of these types of course. | Yes | N/A |
| X= | Abscise (starting at 0) of the pixel of which the color is to be returned. | Yes | N/A | |
| X= | Ordinate (starting at 0) of the pixel of which the color is to be returned. | Yes | N/A |
Then, in the called template, the cgi variable QUERY_STRING will contain a string like "?x,y" where x and y are the exact coordinates of the click on the image. You can get these values, and pass them to CFX_MapClick just by extracting the x,y string from QUERY_STRING, and then get x and y as the first and second elements in a list.<A HREF="testMapClick.cfm"><IMG SRC="states.gif" WIDTH="470" HEIGHT="330" BORDER="0" ALT="" ISMAP></A>
<CFSET QUERY_STRING=listGetAt(QUERY_STRING, 2, "?")>
<CFSET Path=GetDirectoryFromPath(expandPath("*.*"))>
<CFX_mapClick IMAGEFILE="#path#states.gif"
X="#listGetAt(QUERY_STRING,1)#"
Y="#listGetAt(QUERY_STRING,2)#">
![]() |
![]() |
Canada, both in English and French |
![]() |
United States | |
![]() |
![]() |
La France par départements, et par régions |