From: David Mark on 23 Dec 2007 18:37 On Dec 23, 6:24 pm, Randy Webb <HikksNotAtH...(a)aol.com> wrote: > David Mark said the following on 12/23/2007 6:09 PM: > > > > > > > On Dec 23, 5:49 pm, Randy Webb <HikksNotAtH...(a)aol.com> wrote: > >> Thomas 'PointedEars' Lahn said the following on 12/23/2007 5:29 PM: > > >>> ibizara wrote: > >>>> Bart Van der Donck [wrote:] > >>>>> <body onLoad="if (document.getElementById('search')) > >>>>> document.getElementById('search').focus();"> > >>>> Perfect and as this is for a local intranet everyone has IE7 so many > >>>> thanks works great :) > >>> Nevertheless, it is needlessly inefficient (and error-prone). Consider this > >>> more efficient and slightly less error-prone solution: > >>> <body onLoad="var o = document.getElementById('search'); > >>> if (o && o.focus) o.focus();"> > >> Hmm. A "solution" that is still highly error-prone. Maybe you should > >> Google this thread and read it - in its entirety - to find out why it is > >> not as "simple" as you portray it to be. Just because an element has a > >> "focus" property doesn't mean you can set focus to it. > > > No, but it is something that cannot be stipulated by the developer > > (unlike the initial visibility, display and disabled states.) I am > > surprised to see "PointedEars" testing a method by boolean type > > conversion though. We've been over that. > > Nothing Thomas does surprises me anymore. And I do mean *nothing*. > > >>> Consider more feature-testing for an even less error-prone solution. > >> A *lot* more feature-testing. Especially in IE. > > > Which (as I think you previously mentioned) would be a complete waste > > of time (unless you are trying to defend against user style sheets.) > > input{ > visibility: hidden; > display: none; > > } > > Damn that was rude :) If that is in a user style sheet and there are no rules defined in the application's style sheets, then that would indeed have a rude effect. The user would have to be a lunatic though. > > > And IIRC, IE doesn't support user style sheets. > > It does. Tools>Internet Options>General>Accessibility>Format Documents > using my style sheet. I don't think I've ever seen that. > > >> As it is, I can post code that will "break" even your "quick-hack" in at > >> least 4 different ways. Two of which I have already posted. > > > The less said about that "quick-hack" the better. The usual > > translation for that is "bad-code." > > And he always tries to defend it by saying "I said it was a quick hack" > which usually translates to "I didn't have a clue about it, just wanted > to reply". That certainly seems the case here. That was the worst "isVisible" function I have ever seen this side of Prototype. And of course there was no call for it (the thread should have ended long before that post.)
From: Randy Webb on 23 Dec 2007 18:58 David Mark said the following on 12/23/2007 6:37 PM: > On Dec 23, 6:24 pm, Randy Webb <HikksNotAtH...(a)aol.com> wrote: >> David Mark said the following on 12/23/2007 6:09 PM: >>> On Dec 23, 5:49 pm, Randy Webb <HikksNotAtH...(a)aol.com> wrote: >>>> Thomas 'PointedEars' Lahn said the following on 12/23/2007 5:29 PM: <snip> >>>>> Consider more feature-testing for an even less error-prone solution. >>>> A *lot* more feature-testing. Especially in IE. >>> Which (as I think you previously mentioned) would be a complete waste >>> of time (unless you are trying to defend against user style sheets.) >> input{ >> visibility: hidden; >> display: none; >> >> } >> >> Damn that was rude :) > > If that is in a user style sheet and there are no rules defined in the > application's style sheets, then that would indeed have a rude > effect. The user would have to be a lunatic though. That is true. But it shows, very trivially, why it is so difficult to determine if an input can be focused or not. >>> And IIRC, IE doesn't support user style sheets. >> It does. Tools>Internet Options>General>Accessibility>Format Documents >> using my style sheet. > > I don't think I've ever seen that. I found it a long time ago when searching for it in IE as a counterpart to user defined stylesheets in Firefox. -- Randy Chance Favors The Prepared Mind comp.lang.javascript FAQ - http://jibbering.com/faq/index.html Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
From: AKS on 24 Dec 2007 01:10 On Dec 24, 4:58 am, Randy Webb <HikksNotAtH...(a)aol.com> wrote: > ... it is so difficult to > determine if an input can be focused or not. Right conclusion, finally, for the thread named "Form onload focus".
From: Randy Webb on 24 Dec 2007 01:31 AKS said the following on 12/24/2007 1:10 AM: > On Dec 24, 4:58 am, Randy Webb <HikksNotAtH...(a)aol.com> wrote: > >> ... it is so difficult to >> determine if an input can be focused or not. > > Right conclusion, finally, for the thread named "Form onload focus". <sarcasm> No, no, no. You use setActive(), remember? </sarcasm> -- Randy Chance Favors The Prepared Mind comp.lang.javascript FAQ - http://jibbering.com/faq/index.html Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
From: AKS on 24 Dec 2007 02:05
On Dec 24, 11:31 am, Randy Webb <HikksNotAtH...(a)aol.com> wrote: > <sarcasm> > No, no, no. You use setActive(), remember? > </sarcasm> Yes, I'll never forget. :) The right conclusion and my solution (which is not intended for the Code Worth Recommending Project ;) ) have nothing common. OK? |