Print

Author Topic: JavaScript fade-in problem for IE 4.0, solution within  (Read 3471 times)

« on: July 27, 2001, 06:01:00 PM »
In my version of IE (4.72.3110), there is no concept of document filters, so I get not one but TWO annoying JavaScript errors when loading the index page saying that "document.body.filters.0 is not an object"

In JavaScript any time you try to access a property of an object that does not exist, you receive the value null, so you can check against this value to ensure said property exists before manipulating it, and this avoids the problem.

Simply add an if statement around the statements that access filters[0], as such:

if(document.body.filters[0] != null) { ... }

If the field doesn't exist, the code won't execute and no error should occur

Quasar

« Reply #1 on: July 27, 2001, 06:07:56 PM »
Actually I was thinking and it would probably be smarter to check if document.body.filters exists, without adding an index, since if filters is null, the implied dereferencing of null may still cause the same error.  So change the fix above to:

if(document.body.filters != null) { ... }

Quasar

MEGAߥTE

  • In flames
« Reply #2 on: July 27, 2001, 10:29:24 PM »
Yeah.. but that breaks other browsers.. if you're going to use M$ crap, as least use new M$ crap..

MEGAߥTE

  • In flames
« Reply #3 on: July 27, 2001, 10:33:47 PM »
You should check out what you're talking about before you post a "solution" btw.. this is an example of the actual code:
if(document.body.filters&&navigator.userAgent.indexOf('MSIE 5.0')<0){document.body.filters[0].Apply();}

so I'm not sure what the deal is with your browser.. you didn't even tell me what the errors were.

MEGAߥTE

  • In flames
« Reply #4 on: July 27, 2001, 10:35:09 PM »
I guess I need to make sure that it doesn't have "MSIE 4" either because apparently IE4 is too stupid to realize it doesn't have filters..

« Reply #5 on: July 29, 2001, 02:16:33 PM »
Oops sorry I did not realize that you already had that checked, I just assumed that IE should treat the absence of that property properly. I guess you're right, it must have some bug relating to the filters that makes it incorrect.

Deezer says he wants to keep this site compatible with as many browsers as possible, even stating that it worked ok in Netscape 2; that's the only reason I tried to help... I'll look further into the matter.

Quasar

Edited by - Quasar on 7/29/2001 2:11:39 PM

« Reply #6 on: July 29, 2001, 02:32:23 PM »
I just made up a test file with this code:

if(document.body.filters && navigator.userAgent.indexOf('MSIE 5.0') < 0)
{
   if(document.body.filters[0] == null)
   {
      document.writeln("filters[0] is null\n");
   }
   else
      document.body.filters[0].Apply();
}

The if statement is true, so its the filter that's undefined, not document.body.filters Its apparently the method being used to give the page a filter that's not supported, ie this:

<BODY BACKGROUND="_tmk_bg.gif" BGCOLOR="#000000" LINK="#6699CC" VLINK="#6699CC" TEXT="#A8A8A8" ALINK="#00F800"
STYLE="filter:progid:DXImageTransform.Microsoft.Pixelate();">

Is that some kind of VBScript function? I'm not familiar with it myself.

Quasar

David

  • Trusts the fungus
« Reply #7 on: July 30, 2001, 12:07:43 AM »
If anyone cares, I use Opera... and I have never seen the fade in effect. ;)
Let's do the Mario, all together now!

« Reply #8 on: July 30, 2001, 03:02:38 PM »
Too bad it doesn't work for me, I think it would look neat :->  I suppose I really should upgrade my browser like megabyte suggested.

Quasar

« Reply #9 on: August 07, 2001, 11:41:25 PM »
I only see it on my dad's version of IE but not mine, and i'm pretty sure that we have the same versions.  I have a 56K Modem, and he has a 128K, that might be the problem, i don't know...

DaMimster
I wish I had a life, or else I wouldn''t be sitting in front of this computer posting on this message board for others like me.  **Looks at Camera** Hello there, how are yo.. I Lost you anyway...
DaMimster

SMS, SSBM, and MP4... Three games for the gamecube starring Mario/Mario Characters

Print