Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Combined Client/Server Imagemaps

There is a way for you to provide client-side imagemaps that automatically switch to server-side imagemaps if the user's browser doesn't support client-side maps. With a single line of code, you can allow an imagemap to be interpreted either by the end user's software or by the server by including the ismap attribute in the <img /> tag, and then including both a usemap= attribute and cgi-bin/imagemap reference.

<map "#thisthat">
<area shape="rect" coords="0,0,102,99" href="this.htm" />
<area shape="rect" coords="103,0,205,99" href="that.htm" /></map>
<a href="/cgi-bin/imagemap/thisthat">
<img src="thisthat.gif" usemap="#thisthat" ismap /></a>

Here, as with any unrecognized tag, browsers that don't support client-side imagemaps will simply ignore the <usemap> and <ismap> tags and treat the preceding code like an old-fashioned server-side imagemap.

Share ThisShare This

Informit Network