Reputation: 355
var com = {};
var com.Project = function(){
this.display = function(){
alert("hai.....");
}
}
var project_obj = new com.Project();
while creating the project_obj i got an error in IE9 like "Object doesn't support this action"
this code working well in firefox and chrome. i have given a sample code. i'm trying to use Classes and package concept in javastript.
i don't know why this error came in IE.
Upvotes: 2
Views: 947
Reputation: 39270
Based on the working link to your javascript code I think you should change this
$.extend(true, window, container[0]);
to
$.extend(true, window, d);
Upvotes: 0
Reputation: 123473
The problem is the 1st line, as variable names cannot include .
.
If you're trying to namespace, you need to first define com
as an Object
with Project
as one of its properties:
var com = {
Project: function () {
// etc.
}
};
Upvotes: 2
Reputation: 382150
This is illegal in all browsers and raises a syntax error :
var com.Project = function(){
You may do this :
var com = {}; // whatever
com.Project = function(){
Upvotes: 2