2
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.

4
  • Can you give me your project link? Commented Jul 1, 2013 at 6:27
  • my project in intranet ... i can't share my project outside... Commented Jul 1, 2013 at 6:31
  • jsfiddle.net/Qv6BW code avilable in jsfiddle please review my code Commented Jul 1, 2013 at 6:52
  • jsbin.com/otoyim/10/edit in this link project has working very fine Commented Jul 1, 2013 at 7:24

3 Answers 3

2

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(){
Sign up to request clarification or add additional context in comments.

3 Comments

still i got a problem in creating new object
Can you reproduce the problem you have in a fiddle? We don't have enough information to know what it is.
Class : { ? What are you attempting ? This isn't a propert JS construct.
2

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.
    }
};

1 Comment

still i got a problem in creating new object
0

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);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.