<element ondblclick = "fun()">
object.ondblclick = function() { myScript };
object.addEventListener("dblclick", myScript);
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1 id = "heading" ondblclick = "fun()"> Hello world :):) </h1>
<h2> 双击 "Hello world" 查看效果. </h2>
<p> This is an example of using the <b> ondblclick </b> attribute. </p>
<script>
function fun() {
document.getElementById("heading").innerHTML = " Welcome to the bianchenghao6.com ";
}
</script>
</body>
</html>
This is an example of using the ondblclick attribute.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1 id = "heading"> Hello world :):) </h1>
<h2> 双击 "Hello world" 查看效果. </h2>
<p> This is an example of creating the double click event using JavaScript. </p>
<script>
document.getElementById("heading").ondblclick = function() { fun() };
function fun() {
document.getElementById("heading").innerHTML = " Welcome to the bianchenghao6.com ";
}
</script>
</body>
</html>
This is an example of creating the double click event using JavaScript.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1 id = "heading"> Hello world :):) </h1>
<h2> 双击 "Hello world" 查看效果. </h2>
<p> This is an example of creating the double click event using the <b> addEventListener() method </b>. </p>
<script>
document.getElementById("heading").addEventListener("dblclick", fun);
function fun() {
document.getElementById("heading").innerHTML = " Welcome to the bianchenghao6.com ";
}
</script>
</body>
</html>
This is an example of creating the double click event using the addEventListener() method .