Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

crees!

macrumors 68020
Original poster
Jun 14, 2003
2,024
251
MD/VA/DC
As an example the <div> contains just text ("hello") and the div has a width of 300px and height of 100px with a solid border around it. I have a function tied to the onClick handler for the <div> but it only fires when you click on the text. I want it so you can click anywhere within the <div> for it to fire. Unforunately this is for IE5.5+ only.

Any idea how this can be done? I tried setting display:block but that didn't help. Really, I have to be missing something here. Watch it be another "deedeedee" moment that I'm having.

\m/
 
Hmmm... I think I did this once... It worked naturally on Firefox, Safari, etc. but IE was being nasty about it (as usual ;) ). I think you could make it work on IE by using a transparent background image on the div. All you need is a 1px X 1px transparent gif and set background-repeat to repeat.
 
floyde said:
Hmmm... I think I did this once... It worked naturally on Firefox, Safari, etc. but IE was being nasty about it (as usual ;) ). I think you could make it work on IE by using a transparent background image on the div. All you need is a 1px X 1px transparent gif and set background-repeat to repeat.

You know.. that's so weird because I JUST figured this out. My thinking was "don't make me stretch spacer images over each div I need this on and tie an onclick to them." So I tried it with 1 of the div's and it worked. So I put them on a couple more but noticed some of the div that didn't have the spacer yet had their clicks register!!! I have a bunch of nested div's and it seems I only need the spacer in 1 and it'll work for all others in that container. Damn IE, ruining my day.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.