Why can only newest button work ? I find that other button's onclick function is null
<pre><code>function B(sName) {
    this.name = sName;
}
B.prototype = {
    instanceCreatButtonCount: 0,
    funA: function () { // alert instance's name
        alert(this.name);
    },
    funB: function () { // create a button which clikced can alert this instance's name through funA;
        var that = this;
        B.prototype.instanceCreatButtonCount++;
        var id = "_id" + that.instanceCreatButtonCount;
        var str = "&lt;button id='" + id + "' &gt;clike me&lt;/button&gt;";
        var a = document.getElementById("btns");
        a.innerHTML += str;
        var btn = document.getElementById(id);
        btn.onclick = function () {
            that.funA();
        };
    }
};
var b1 = new B("Jim");
var divB1 = document.getElementById("b1");
divB1.onclick = function () {
    b1.funB();
}
var b2 = new B("Dad");
var divB2 = document.getElementById("b2");
divB2.onclick = function () {
    b2.funB();
}
</code></pre>

<ul>
<li><p>After I click divB1, I create a button through b1.funB().</p></li>
<li><p>After I click divB2, I create a button througb b2.funB().</p></li>
</ul>

<p>Why can only newest button alert name ?  I find that other button's onclick function is null.</p>
