SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Aug 2005
    Location
    Lithuania, Europe
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Constant problem in IE

    I've run into a problem with constants in IE:

    Code JavaScript:
    const MODAL_OVERLAY_OPACITY = 0.6;
     
    // ...
     
    function initServiceTermsButton()
    {
      new Control.Modal('service-terms', {width:   480,
                                          height:  640,
                                          opacity: MODAL_OVERLAY_OPACITY});
    }
    IE doesn't seem to like this code. I get errors indicating that some functions are undefined even though they are. If I remove the constant declaration and replace MODAL_OVERLAY_OPACITY in initServiceTermsButton() with the actual value, IE doesn't complain. I don't have this problem with Firefox.

    Any ideas what I may be doing wrong, or is this yet another IE bug?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    IE provides only JavaScript 1.3 support.
    The CONST statement is a feature from JavaScript 1.5
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Addict
    Join Date
    Aug 2005
    Location
    Lithuania, Europe
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All right, thanks for informing me.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    That's alright.

    Mozilla keeps a good reference to javascript. The one about the const statement is at:
    http://developer.mozilla.org/en/docs...atements:const

    And a simple test is all it takes to discover what version of javascript a certain browser supports.
    http://forums.microsoft.com/MSDN/Sho...PostID=2870479
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •