编码 :
function CreateDiv(D) {
D.width = this.width;
D.height = this.height;
D.position = "absolute";
D.bottom = 0;
D.right = function () { };
D.id = Math.floor((Math.random() * 10) + 1);
D.data = function () {
return "this is data of Div" + D.id;
};
D.create = function () {
var divToAppend = "<div id='" + D.id + "' style='border:1px solid black;width:20;height:20;' >" + D.data + "</div>";
return divToAppend;
// $("#Container").append(divToAppend);
};
}
function NewChat() {
var divv = new CreateDiv({width:200,height:200});
alert(divv.create); // undefiend
}
谁能告诉我我做错了什么?