Hello.
function A() {
this.myProp = document.createElement("div"); }
function B(id) {
this.myProp.id = id;
document.body.appendChild(this.myProp); }
B.prototype = new A();
window.onload = function() {
new B("hello");
new B("goodbye"); }
What happens here is that I end up with one div with id "goodbye". What I would like is two divs with the specified ids.
I have been able to fix this problem by creating a method of "A" which creates the element.
How could I fix it without using the method?