JavaScript ondblclick event
The JavaScript ondblclick event is one of the JavaScript event events. Its function is similar to the onclick event. The biggest difference is that ondblclick must be triggered when the user double-clicks a web page element. Clicking will have no effect. It feels like it is in the operating system. On the top, click a folder to select the folder, double-click the folder to open it, the same effect can be moved to the web page, you can use ondblclick to create, all mainstream browsers support the ondblclick event effect.
JavaScript ondblclick event syntax
ondblclick = "javascript function to be executed"
The main function of the ondblclick event is the same as other JavaScript events . It is used to monitor the user's behavior. When the user double-clicks a specific element, it immediately triggers the function that is prepared to be executed, and then the function starts to work. And ondblclick succeeded.
JavaScript ondblclick event example
function ShowName(){
alert('Your name is:'+document.getElementById("MyName").value);
}
</script>
Please enter your name: <input type="text" id="MyName">
<input type="button" value="Double click to get the name just entered" ondblclick='ShowName()'>
Post a Comment
0 Comments