Results 1 to 4 of 4

Thread: Help! I'm lost.

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

    Default Help! I'm lost.

    This code:
    Code:
    var Class = function (class) {
      return Object (function () {
        var props = new Object ();
        props.inherit = true;
        props.super = function (class) {
          return function () {
            class.apply (props,arguments);
          };
        };
        if (typeof this.inherit != "undefined") {
          props.private = this.private;
          props.public = this.public;
        }
        else {
          props.private = new Object ();
          props.public = this;
        }
        class.apply (props,arguments);
      });
    };
    It works fine in Firefox, but IE says at line 2, char 23, "expected identifier". I have no idea what that means. Line 2, char 23, is right about in the middle of my second "function". Please help me!

    Thanks,
    Stephen

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    'class' is a reserved word.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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

    Default

    The capital one or lowercase, or both?

  4. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    All variations of a word should be avoided to avoid confusion as some browsers ignore capitalization.
    http://javascript.about.com/library/blreserved.htm

    Good luck!

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
  •