<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Close window</title>
</head>
<body>
<button id="abc" onclick="temp1()">button</button>
<script type="text/javascript">
function temp1() {
alert("temp1");
};
function temp2() {
alert("temp2");
}
document.getElementById("abc").addEventListener("click", temp2, false);
</script>
</body>
</html>
&#13;
但我想展示&#34; temp2&#34;首先,然后显示&#34; temp1&#34;
这可能吗?或者事件执行顺序取决于浏览器,所以我无法改变它?
感谢您的帮助!!
答案 0 :(得分:1)
您可以通过以下几种方式保证订单:
document.getElementById("abc").addEvenListener("click", function() {
temp2();
temp1();
}, false);
另一种选择是:
function temp2() {
alert();
temp1(); // call temp1 at the end of temp2
}
document.getElementById("abc").addEventListener("click", temp2, false);
答案 1 :(得分:0)
请查看以下内容:
boolean onDoubleTap (MotionEvent e) -