Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17438
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="UTF-8" |
| Message-ID | <2191909.4EKZz3fc86@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Mon, 03 Dec 2012 23:15:40 +0100 |
| User-Agent | KNode/4.4.11 |
| Content-Transfer-Encoding | 8Bit |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== |
| Subject | Re: IE9 is not a friend... |
| Newsgroups | comp.lang.javascript |
| References | <6de7edc4-756c-40a1-ae6b-98ba94062284@m13g2000vbd.googlegroups.com> <C6mdnSBWLPzeiCDNnZ2dnUVZ_sydnZ2d@westnet.com.au> |
| Followup-To | comp.lang.javascript |
| MIME-Version | 1.0 |
| Lines | 51 |
| NNTP-Posting-Date | 03 Dec 2012 23:15:42 CET |
| NNTP-Posting-Host | b5e16711.newsspool1.arcor-online.net |
| X-Trace | DXC=`3dbeR8[k<SaAeROF2PWMQic==]BZ:af^4Fo<]lROoRQnkgeX?EC@@Pc43BI^Y;R1WDZm8W4\YJN\R=i2=[N6Y6ZjNe=bP<NoD_9eYl`U<2WoR |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | csiph.com comp.lang.javascript:17438 |
Followups directed to: comp.lang.javascript
Show key headers only | View raw
Andrew Poulos wrote:
> On 4/12/2012 8:04 AM, justaguy wrote:
>> Here's a simple js function.
>>
>> // detect if any of 4 fields is empty before data entry in field 5
>> function haveFour() {
>> var fourFields = ['rep','contact','Market_Segment','pricing'];
>> for (i=0; i<4; i++) {
>> if (document.getElementById(fourFields[i]).value=='') {
>> alert('Please fill in '+fourFields[i] + ' field');
>> return;
>> }
>> }
>> }
>>
>> However, it works as designed for Chrome 23, Firefox 16
>> but it fails with IE9. All on Windows 7.
>> Any idea as to the reason of failing IE9?
>
> What about testing for
> if (!document.getElementById(fourFields[i]).value.length) {
> instead?
That would be unnecessarily cryptic, error-prone and comparably inefficient
on top of the already inefficient approach.
> Also I'd put 'i' in with 'var' ie
> var i, fourFields...
> and add
> var len = fourFields.length;
> for (i = 0; i < len; i++) {
Or
var fourFields = …;
for (var i = 0, len = fourFields.length; i < len; i++)
{
> We need to see the HTML to know what might be going awry.
More important, we need to know their definition of an "empty field" and
"fails".
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
IE9 is not a friend... justaguy <lichunshen84@gmail.com> - 2012-12-03 13:04 -0800
Re: IE9 is not a friend... Andrew Poulos <ap_prog@hotmail.com> - 2012-12-04 08:10 +1100
Re: IE9 is not a friend... Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-12-03 22:41 +0100
Re: IE9 is not a friend... justaguy <lichunshen84@gmail.com> - 2012-12-03 14:06 -0800
Re: IE9 is not a friend... justaguy <lichunshen84@gmail.com> - 2012-12-03 14:27 -0800
Re: IE9 is not a friend... Christoph Becker <cmbecker69@gmx.de> - 2012-12-04 15:05 +0100
Re: IE9 is not a friend... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-03 23:20 +0100
Re: IE9 is not a friend... Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-12-03 23:41 +0100
Re: IE9 is not a friend... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-04 15:23 +0100
Re: IE9 is not a friend... Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-12-04 16:12 +0100
Re: IE9 is not a friend... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-03 23:15 +0100
Re: IE9 is not a friend... "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-12-03 23:15 +0200
csiph-web