<分区>
我有两个功能:
doSomething = function() {
alert(this);
}
var doSomethingElse = function() {
alert(this);
}
这是我的 HTML:
<div id="banner-message">
<p>Hello World</p>
<button id='button1' onclick='doSomething()'>Do Something</button>
<button id='button2' onclick='doSomethingElse()'>Do Something Else</button>
</div>
为什么 doSomething()
函数调用起作用而 doSomethingElse()
不起作用?