Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can I define areas inside elementa and apply events on them?

    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?

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,033
    Thanks
    0
    Thanked 248 Times in 245 Posts
    Just create a small div inside a bigger div.
    Code:
    <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>
    </div>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •