Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!137.226.231.214.MISMATCH!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Mel Smith" Newsgroups: comp.lang.javascript Subject: Re: 'onblur' problem Date: Mon, 18 Mar 2013 17:45:54 -0700 Lines: 56 Message-ID: References: X-Trace: individual.net yiRSjBXrhFv2qGjdhngXEgIbj6ogTtqxlKTRTlO2jIeum0qy+f Cancel-Lock: sha1:0F7k1UxKMpQ+4QGzZS/VmFmVbR0= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: csiph.com comp.lang.javascript:18941 Stefan said: >> Normal Operation: >> If the user fails to 'select' one of the several options in the >> element. I do this until he >> 'selects' one of the options. Works good ! > > If you say so. > I appreciate your warning about this technique. But my (potential) users have decidedly different methods/needs of entering information in this table (6 rows, 21 columns of single-character input). So, they have a choice of vertical, horizontal, partial, none, etc, etc) for their preferred table entry method. The completed table will be abstracted by JS and presented as 6 strings of 21 chars each and returned to my server. ( and right now, setting the tabIndex for the 130-odd input table fields works properly on Chrome, Safari and FF, but goes 'nuts' in IE8 and IE9. And I'm too tired to set up a test page for this groups perusal. Sigh ...) >> Problem Operation (at least for IE8) : >> If the user clicks the 'X' (eXit the browser) button in the top-right >> corner *before* selecting an option, my IE8 browser senses the 'onblur' >> event and shows the alert message -- even though by that time the browser >> has already shutdown. Very messy of me to allow this. >> >> Question: >> How can I sense that the user is simply closing down the browser, and >> stop the onblur event from presenting the alert() message. > > I would strongly recommend changing the onblur-alert-focus behavior of > your form. Forcing the user's focus to where they don't want it is a > really good way to annoy users. There are better methods for handling > incorrect or missing form values. > This insistence of establishing a table-entry method is essential. > This type of obtrusive scripting is what gave JS its bad name. > > If you don't care about that, you may be able to get away with a short > artificial timeout between the blur event and your alert. Closing the > window should clear the timeout, and the alert() will never execute. I will check timeout method tomorrow. Seeems like a good idea. Thank you ! -Mel Smith