使用事件参数与其他参数? [英] Use event arguments with other arguments?
本文介绍了使用事件参数与其他参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这就是我想要做的:
function someEvent(e) {
}
onxxxx="someEvent()"
和把它转换成:
function someEvent(e, arg1, arg2) {
}
onxxxx="someEvent(???)"
所以基本上,我想通过其他参数包括默认事件
之一,但我不知道怎么和
So basically, I want to pass other arguments including the default event
one, but I'm not sure quite how to
推荐答案
您可以传递事件对象作为参数:
You can pass the event object as an argument:
onxxxx="someEvent(event, arg1, arg2);"
事件
必须是文字事件
在这里。
在事件处理函数你找到他们,像这样:
Within the eventhandler function you find them like so:
function someEvent(e, a, b) {
// e === event object
// a === arg1
// b === arg2
}
这篇关于使用事件参数与其他参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文