html_js - 绑定事件获取event
html_js - 绑定事件获取event
绑定事件获取event
- 元素绑定事件参数
<!-- 传入参数event
必须是event,e或其他都无法获取PointerEvent
-->
<div class="player_progress" onclick="clickPlayerProgress(event)"></div>
- js 绑定事件参数默认event
<p id="foo">click on this element.</p>
<script>
var p = document.getElementById("foo"); // Find the paragraph element in the page
p.onclick = showAlert; // Add onclick function to element
function showAlert(event) {
alert("onclick Event triggered!");
}
</script>
Lee2