I have this function(class) which I define a prototype function.
function testit(t,l, w, h, c, p) {
this.div;
this.obj = { "top": t, "left": l, "width": w, "height": h, "color": c };
}
testit.prototype.showit = function () {
this.div = $("<div />")
.css({
"position": "absolute",
"top": this.obj.top,
"left": this.obj.left,
"width": this.obj.width,
"height": this.obj.height,
"border": "1px solid " + this.obj.color
})
.appendTo(p);
}
When running the following code -
var aa;
aa = new testit(100, 100, 100, 100, "#CCCCCC", "body");
aa.showit();
I get the following error -
What is wrong with the prototype definition ?