Skip to main content

Posts

Showing posts with the label Image Map

Using JavaScript Image Map

JavaScript can be used to create client-side image maps, which are defined using the <map> and <area> tags in conjunction with the usemap attribute of the <img /> tag. The <map> element acts as a container for defining clickable hotspots within an image. Each <area> tag specifies a shape and coordinates for the hotspot. Below is an example demonstrating how to use an image map with JavaScript to display different messages when hovering over specific areas of an image: <html> <head> <title>Using JavaScript Image Map</title> <script type="text/javascript"> function showTutorial(name) { document.myform.stage.value = name; } </script> </head> <body> <form name="myform"> <input type="text" name="stage" size="20" /> </form> <img src=&quo