Re: IE6 onlick not firing
- From: "Dave Anderson" <GTSPXOESSGOQ@xxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 07:48:45 -0500
Will Holley wrote:
> We have a number of anchor tags in our web app which look like:
>
> <a href='javascript:void(0)' class = 'btnExpand' onclick = 'return
> showDetails()'>+</a>
Just out of curiosity, why are you returning a value? If false, the void
operator is not called. If true, it is. Since void evaluates an expression
without returning a value, what is the point of doing it conditionally,
especially when that expression is a constant?
Side note: as an operator, void does not require parentheses. "void 0" and
"void(0)" are equivalent, except that the parentheses force an unneccessary
evaluation.
Side side note: http://jibbering.com/faq/#FAQ4_24
> However, if we change the code to be:
>
> cell.innerHTML = "<a href='javascript:void(0)'
> class='btnExpand'>+</a>"; cell.firstChild.onclick = showDetails;
>
> then all is ok again!
Notice the difference? You are not returning a value in this one. Makes you
wonder why you ever did (since all is ok without returning a value), doesn't
it?
> 1. Our app is targeted at IE6+.
Meaning you don't even need <a> tags, since IE rightly supports click events
on many containers. Furthermore, since you already have a defined style, you
can make it look clickable:
.btnExpand { cursor:pointer }
<span class="btnExpand" onclick="showDetails()">+</span>
> 2. Changing all events in the app is not an option.
Of course it's an option: 1) If you cannot make them work for all users any
other way, then you will correct the way they are written, and 2) They are
incorrectly implemented and *should* be changed.
> 3. On one machine the original code works for some users and not for
> others (active dir 2003 profiles - all admins and supposedly
> identical).
> 4. Conversely, the behaviour follows the user profile around on
> whatever machine they happen to use.
#4 demands that #3 is true for all machines. And it is somewhat inconsistent
with "We recently bought a bunch of new development machines and for some
developers, the onclick event does not fire."
> 5. In a test page in the same app inline onclick events always work
> for all users.
How does the test page differ from the non-working ones?
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
.
- Follow-Ups:
- Re: IE6 onlick not firing
- From: Roland Hall
- Re: IE6 onlick not firing
- References:
- IE6 onlick not firing
- From: Will Holley
- IE6 onlick not firing
- Prev by Date: Re: IE6 onlick not firing
- Next by Date: Re: IE6 onlick not firing
- Previous by thread: Re: IE6 onlick not firing
- Next by thread: Re: IE6 onlick not firing
- Index(es):
Relevant Pages
|
Loading