Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #17433

Re: IE9 is not a friend...

Date 2012-12-04 08:10 +1100
From Andrew Poulos <ap_prog@hotmail.com>
Newsgroups comp.lang.javascript
Subject Re: IE9 is not a friend...
References <6de7edc4-756c-40a1-ae6b-98ba94062284@m13g2000vbd.googlegroups.com>
Message-ID <C6mdnSBWLPzeiCDNnZ2dnUVZ_sydnZ2d@westnet.com.au> (permalink)

Show all headers | View raw


On 4/12/2012 8:04 AM, justaguy wrote:
> Hi,
>
> 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? Also I'd put 'i' in with 'var' ie
   var i, fourFields...
and add
   var len = fourFields.length;
   for (i = 0; i < len; i++) {

We need to see the HTML to know what might be going awry.

Andrew Poulos

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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