View Full Version : Can I define areas inside elementa and apply events on them?

05-12-2007, 09:50 PM
Let's say I have a div element and I would like to set an event only on a specific area of that div, say, a 5x5px rectangle on the top left. Can it be done?

05-12-2007, 10:13 PM
Just create a small div inside a bigger div.

<div id="box" style="width:100px;height:100px;border:1px solid blue;">
<div id="box2" style="width:5px;height:5px;font-size:5px;border:1px solid red;" onclick="alert('box2')"></div>