Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
HTML Articles
Page 133 of 151
What is the role of ctrlKey Mouse Event in JavaScript?
The ctrlkey mouse event property is used to show whether the CTRL key is pressed or not when the mouse button is clicked.ExampleYou can try to run the following code to learn how to implement ctrlKey Mouse event in JavaScript. Press and hold CTRL key and then click here. function funcCtrlKey(event) { if (event.ctrlKey) { alert("CTRL key: Pressed"); } else { alert("CTRL key: NOT Pressed"); } }
Read MoreWhat is the role of shiftKey Mouse Event in JavaScript?
The shiftkey mouse event property is used to show whether SHIFT key is pressed or not when mouse button is clicked.ExampleYou can try to run the following code to learn how to implement shiftKey Mouse event in JavaScript. Press and hold SHIFT key and then click here. function funcShiftKey(event) { if (event.shiftKey) { alert("SHIFT key: Pressed"); } else { alert("SHIFT key: NOT Pressed"); } }
Read MoreWhat is the role of clientX Mouse Event in JavaScript?
When a mouse event is triggered, the clientX mouse event property is used to get the horizontal coordinate of the mouse pointer. This is according to current window.ExampleYou can try to run the following code to learn how to implement clientX Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates (according to current window) of the mouse pointer. function coordsFunc(event) { var x_coord = event.clientX; var y_coord = event.clientY; var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord; document.write(xycoords); }
Read MoreHow [ ] is converted to Number in JavaScript?
Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert [ ] to Number in JavaScript. Example Convert [] to Number var myVal = []; document.write("Number: " + Number(myVal));
Read MoreWhat is the role of altKey Mouse Event in JavaScript?
The altkey mouse event property is used to show whether SHIFT key is pressed or not when mouse button is clicked.ExampleYou can try to run the following code to learn how to implement altKey Mouse event in JavaScript. Press and hold ALT key and then click here. function funcAltKey(event) { if (event.altKey) { alert("ALT key: Pressed"); } else { alert("ALT key: NOT Pressed"); } }
Read MoreWhich event occurs in JavaScript when an element is content is copied to clipboard?
When a user copies the element’s content, then the oncopy event triggers.ExampleYou can try to run the following code to learn how to implement oncopy event in JavaScript. function copyFunction() { document.write("Text copied!"); }
Read MoreWhat is the usage of onsearch event in JavaScript?
The onsearch event is useful for search i.e. a user press ENTER or “x” key in input element. The type for is search, since it is for users to search. The onsearch event isn’t supported in Internet Explorer, Firefox, and Opera.ExampleYou can try to run the following code to learn how to implement onsearch event in JavaScript. Write what you want to search below and press "ENTER". function searchFunc() { var a = document.getElementById("newInput"); document.write("Searched = " + a.value); }
Read MoreWhat is the usage of oninvalid event in JavaScript?
The oninvalid event is triggered if the field value added in is invalid. Add a message if the user forgets to fill the form before submission.ExampleYou can try to run the following code to learn how to implement oninvalid event in JavaScript. function resetFunct() { alert("The form was reset"); } Enter Name: Enter birth month:
Read MoreWhat is the usage of onfocus event in JavaScript?
The onfocus event is triggered when element gets focus. You can try to run the following code to learn how to implement onfocus event in JavaScript.Example Write below: function newFunc(x) { x.style.background = "blue"; }
Read MoreWhat is the usage of onblur event in JavaScript?
The blur event triggers when object lose focus. You can try to run the following code to learn how to implement onblur event in JavaScript.Example Write below: function newFunc(a) { a.style.background = "green"; }
Read More