我有这样的事件监听器:
document.getElementById("A").addEventListener("change", function (e) {
// do something with e parameter when A change
}, false)
document.getElementById("B").addEventListener("click", function (e) {
// do something with e parameter when B click
}, false)
我有两个问题:
- 我应该如何在事件处理程序版本中编写它?
- 我该怎么称呼它?
它应该是这样的:
<script type="text/javascript">
function [this is question number 1]
{
// do something with e parameter when A change
}
function [this is question number 1]
{
// do something with e parameter when B click
}
</script>
<div id="A" change="[this is question number 2]"></div>
<div id="B" click="[this isquestion number 2]"></div>
问候,
达夫