Results 1 to 4 of 4

Thread: IE is complaining and I can't figure out why.

  1. #1
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default IE is complaining and I can't figure out why.

    If you want all of my code, it's at http://subatomicfusion.webs.com/js/test.htm. From there, there is an external Javascript file at http://subatomicfusion.webs.com/js/SOM/Element.js. In Firefox and Safari, my test.htm should be a rectangle with some colors and a box with text in it, and the whole thing should have a Picachu cursor. In IE this doesn't happen. It complains about an "Invalid Argument." at line 137, char 3, and this is on my Element.js file. The code around there is as follows, starting with line 135 and ending with 138 (137 is the }; one):
    Code:
    private.setStyle = function (name,value) {
    private.element.style [name] = value;
    };
    //Methods
    If I comment out private.element.style [name] = value;, there are no errors except that all the colors are based on styles so half my stuff doesn't show up. Could someone tell me why IE told me the wrong line number, and what the problem really is? It would be greatly appreciated.

    Thanks,
    Stephen

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,925
    Thanks
    43
    Thanked 3,190 Times in 3,154 Posts
    Blog Entries
    12

    Default

    If it is that line, that means that:

    Code:
    private.element.style [name] = value;
    or something about it or the entire function is the real problem, so I would try getting rid of the non-standard space in its syntax, ex:

    Code:
    private.element.style[name] = value;
    If that doesn't get it, another thing to try is to make sure that all arguments fed to this:

    Code:
    private.setStyle = function (name,value)
    are valid style property/value pairs in IE. Other browsers may have an error here but not make a big issue over or halt processing on it, IE can be finicky in this area.

    Also make sure (via temporary alerts or whatever inserted into your code) that private means the same thing in IE here as it does in the browsers that this code is working with.

    Generally though, and if none of this helps, to be sure of getting an accurate error line number (+- 1) in IE, all scripts must be on the page. Temporarily make all scripts on page scripts, rather than external in order to diagnose this properly.

    Edit: Also, both private and public are reserved words, it would be best to use others, like:

    myprivate

    mypublic
    Last edited by jscheuer1; 03-25-2009 at 01:42 AM. Reason: add info
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default

    Thanks for the suggestions. It turned out that IE freaked out when something tried to set a height/width of "NaNpx".

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,925
    Thanks
    43
    Thanked 3,190 Times in 3,154 Posts
    Blog Entries
    12

    Default

    That would fall into the category of:

    . . . make sure that all arguments fed to this:

    Code:
    private.setStyle = function (name,value)
    are valid style property/value pairs in IE.
    And, as I'm pretty sure, if that's the problem, you would be able to do a (at some point in the code):

    Code:
    if (!isNaN whatever)
     something that uses the number
    or something similar.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •