Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6880889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:02:13+00:00 2026-05-27T05:02:13+00:00

When running OpenLayers map in IE9 I get a Unable to get value of

  • 0

When running OpenLayers map in IE9 I get a “Unable to get value of the property ‘displayClass’: object is null or undefined” error message.

After looking around at the problem, it seems that this line in the Openlayers.js file is the problem

this.controls=this.controls.concat(controls);
for(var i=0,len=controls.length;i<len;i++)
{var element=document.createElement("div");
element.className=controls[i].displayClass+"ItemInactive"; /* Problem here */
controls[i].panel_div=element;if(controls[i].title!="")
{controls[i].panel_div.title=controls[i].title;}

The script for my custom toolbar is:

OpenLayers.Control.CustomNavToolbar = OpenLayers.Class(OpenLayers.Control.Panel,{
    initialize: function(options){
        OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
        this.addControls([
            new OpenLayers.Control.Navigation({displayClass: 'olControlNavigation', zoomBoxEnabled:false}),
            new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Point, {displayClass: 'olControlDrawPoint'}),
            new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Path, {displayClass: 'olControlDrawPath'}),
            new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Polygon, {displayClass: 'olControlDrawPolygon'}),
            new OpenLayers.Control.ZoomBox({displayClass: 'olControlZoomBox', alwaysZoom:true}),
        ])
        this.displayClass = 'olControlCustomNavToolbar'
    },
    draw: function(){
        var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
        this.defaultControl = this.controls[0];
        return div;
    }
});
var panel = new OpenLayers.Control.CustomNavToolbar({div:OpenLayers.Util.getElement('panel')});
map.addControl(panel);

With CSS

    olControlCustomNavToolbar{
        float:left;
        right:0px;
        top:0px;
        width:160px;
        height:24px;
        margin:0px 6px 0px 0px;
    }   
    .olControlCustomNavToolbar div{
        float:right;
        height:24px;
        width:160px;
        margin:0px 0px 0px 6px;
    }
    .olControlCustomNavToolbar .olControlNavigationItemActive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/pan_on.png")!important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlNavigationItemInactive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/pan_off.png")!important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlDrawPointItemActive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/draw_point_on.png")!important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlDrawPointItemInactive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/draw_point_off.png")!important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlDrawPathItemActive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/draw_line_on.png") !important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlDrawPathItemInactive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/draw_line_off.png") !important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlDrawPolygonItemActive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/draw_polygon_on.png") !important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlDrawPolygonItemInactive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/draw_polygon_off.png") !important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlZoomBoxItemActive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/drag-rectangle-off.png") !important;
        background-repeat: no-repeat;
    }
    .olControlCustomNavToolbar .olControlZoomBoxItemInactive{
        width:24px !important;
        height:24px !important;
        margin:3px 0px 0px 6px !important;
        background-image: url("/OpenLayers-2.11/theme/default/img/drag-rectangle-on.png") !important;
        background-repeat: no-repeat;
    }

Could anyone give a little insight into what I am doing wrong here? Thank you

EDIT: FYI This works fine in Firefox, Chrome and Opera. Only IE has this problem.

EDIT: Sorry I made a mistake I was running with IE7 Compatible; to rephrase after taking down the tag: meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ it works fine in IE9.

Alternately it does NOT work in IE7 or IE8 mode, if anyone has any ideas still looking to get this working in IE7 and IE8. Thanks, sorry for the confusion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:02:14+00:00Added an answer on May 27, 2026 at 5:02 am

    In your OpenLayers.Control.CustomNavToolbar class, the this.addControls parameter array has a trailing comma.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running the example code for the Facebook API I get a null session object,
running sqlbulkcopy in c# and I get an error: WriteToServer: Connection property has not
Running into a problem where on certain servers we get an error that the
Running gcc v3.4.6 on the Botan v1.8.8 I get the following compile time error
Running FxCop on my code, I get this warning: Microsoft.Maintainability : 'FooBar.ctor is coupled
running gacutil.exe /i ProjectX.Core.dll , I got the message: Assembly sucessfully added to te
Running Windows PHP 4.4.2 \cli\php.exe fails with an error Cannot find php4ts.dll if the
I've got geodjango running using openlayers and OpenStreetMaps with the admin app. Now I
I am still trying to get my server running OpenStreetMap. I have TileCache and
Running the debugger in Xcode when you set a breakpoint you get a view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.