[dojo]监控事件没有实现
huing 2009-01-06 04:57:11 <script type="text/javascript" src="http://o.aolcdn.com/dojo/1.2/dojo/dojo.xd.js"></script>
<script type="text/javascript">
function append(message) {
var test = document.createElement("div");
test.innerHTML = " the create div ";
document.body.appendChild(test);
}
function connect() {
dojo.connect(document.body, "appendChild",
function() {
dojo.byId("myDiv").innerHTML += "Intercepted appendChild";
});
dojo.byId("myDiv").innerHTML += "dojo.event.connect(...) completed";
}
function updateHtml()
{
dojo.byId("myDiv").innerHTML += "Intercepted appendChild";
}
</script>
<body>
<ol>
<li>
<button onClick="connect();">Step 1</button>
Connect up appendChild method
</li>
<li>
<button onClick="append('[Step2]');">Step 2</button>
Attempt appendChild after the connect
</li>
</ol>
<div id="myDiv">
[Initial Content for myDiv]
</div>
</body>
源代码如上,为什么connectt的事件没有触发