[Javascript] Safari issues or better saying poor programming issues

MEM talofo at gmail.com
Fri Apr 9 09:10:21 CDT 2010


      2010/3/31 David Lovering <dlovering at gazos.com>

>
>> When an onClick occurs it generally locks both focus and select, as well
>> as
>> creating the 'click' event itself.  [Assuming again the object hasn't
>> already been disabled or rendered unfocusable].  Then it is merely a
>> matter
>> of sorting out the precedence of which comes first - onClick, onSelect, or
>> onFocus.
>>
>

 That information was precious.
I have changed for onclick and forget about on focus, but on Firefox 3.6 on
Mac (I don't know about other OS), the onclick doesn't work, but the focus
did.
So, since your suspictions were about the interpretation of onFocus and
onClicl, I have just decided to do it, "step by step":

1) Show the input field.
2) Set the focus.
3) Set the click.

Like this:
function activaInput()
{
    document.candidaturaOnline.txtOutro.disabled=false;
    document.candidaturaOnline.txtOutro.focus=true;
    document.candidaturaOnline.txtOutro.click=true;
}

function desactivaInput()
{
    document.candidaturaOnline.txtOutro.disabled=true;
    document.candidaturaOnline.txtOutro.blur=true;
}

Now it works cross-browser.

;)

One last question if you don't mind:
Should we make the DOM Path like above, or should we use getElementById ?
Not relevant?


Thanks a lot for the info really precious.


Regards,
Márcio


More information about the Javascript mailing list