[SLUG] curious javascript phenomenon
Hi. I have a javascript file that gets imported into a php page. The javascript checks form entry. Basically, the script checks for empty fields with: /~ function isEmptyString(s) { for (var i = 0; i < s.length; i++) { var c = s.charAt(i); if((c != ' ') && (c != '\n') && (c != '\t')) { return false; } // end if } // end for return true; } // end isEmptyString() \_ Then in some cases, it checks for non-empty fields using '!isEmptyString()' and evaluates a field for correct data. The curious thing about this is that if I name the the file: 'cust.js', one particular field doesn't get checked. If I name the file something else like 'testJS2.js', then all checking works absolutely perfectly. I have copied the working file to the non-working file and then tried 'cust.js' again. However, the same error. Both files are exactly the same size. That baffles me. I've tried starting a fresh browser (firefox), thinking it may be a cache problem. In fact that's still the only thing I can attribute this too. Anyone have any clues? Kind regards. Luke. -- ._.. .| .| |.|/.|_ . .|__.|_|.|\.|_ . :61 421 276 282: -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] curious javascript phenomenon
Oops. It was cache :-( I hadn't closed all browser instances. KR. Luke. 31Aug2005 @ 12:22 [EMAIL PROTECTED] thusly spake > Hi. > > I have a javascript file that gets imported into a php page. > The javascript checks form entry. > Basically, the script checks for empty fields with: > > /~ > function isEmptyString(s) { > for (var i = 0; i < s.length; i++) { > var c = s.charAt(i); > if((c != ' ') && (c != '\n') && (c != '\t')) { > return false; > } // end if > } // end for > return true; > } // end isEmptyString() > \_ > > Then in some cases, it checks for non-empty fields using > '!isEmptyString()' and evaluates a field for correct data. > > The curious thing about this is that if I name the the file: > 'cust.js', one particular field doesn't get checked. > If I name the file something else like 'testJS2.js', then all checking works > absolutely perfectly. > > I have copied the working file to the non-working file and then tried > 'cust.js' > again. However, the same error. > Both files are exactly the same size. > > > > That baffles me. > > I've tried starting a fresh browser (firefox), thinking it may be a cache > problem. In fact that's still the only thing I can attribute this too. > > Anyone have any clues? > Kind regards. > Luke. > > -- > ._.. > .| .| |.|/.|_ . > .|__.|_|.|\.|_ . > :61 421 276 282: > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- ._.. .| .| |.|/.|_ . .|__.|_|.|\.|_ . :61 421 276 282: -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] curious javascript phenomenon
On 8/31/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I have a _javascript_ file that gets imported into a php page. The curious thing about this is that if I name the the file:'cust.js', one particular field doesn't get checked. If I name the file something else like 'testJS2.js', then all checking worksabsolutely perfectly. Do you have more that one _javascript_ fragment called 'cust.js'? -- Make the most of your skills - with OpenSkillshttp://www.openskills.org/ -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html