<html>
<body>
<p>此示例使用 HTML DOM 将“ondblclick”事件分配给 p 元素。</p>
<p id="demo">双击我。</p>
<script>
document.getElementById("demo").ondblclick = function() {myFunction()};
function myFunction() {
document.getElementById("demo").innerHTML = "我被双击了!";
}
</script>
</body>
</html>