Re: IE6 onlick not firing



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.


.



Relevant Pages

  • Re: Some Problem With FileSystemWatcher openNETCF
    ... void File_Monitor_Deleted(object sender, FileSystemEventArgs ... I want after i start my app and browse for example to the My Documents ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: WM_COPY,WM_PASTER override in CEdit
    ... The problem has to do with the overrides to WM_COPY and WM_PASTE in my ... I have 2 edit controls in a dialog based app. ... afx_msg void OnPaste; ...
    (microsoft.public.vc.mfc)
  • IE6 onlick not firing
    ... The onclick event appears to function correctly and has done for many ... Our app is targeted at IE6+. ... the behaviour follows the user profile around on whatever ... p.s. apols for the cross post - had to post again for managed support ...
    (microsoft.public.scripting.jscript)
  • Re: IE6 onlick not firing
    ... the onclick event does not fire. ... Our app is targeted at IE6+. ... On one machine the original code works for some users and not for ... without even the implied warranty of merchantability ...
    (microsoft.public.scripting.jscript)
  • Re: IE6 onlick not firing
    ... the onclick event does not fire. ... Our app is targeted at IE6+. ... On one machine the original code works for some users and not for ... > p.s. apols for the cross post - had to post again for managed support ...
    (microsoft.public.scripting.jscript)

Loading