HTML Articles

Page 133 of 151

What is the role of ctrlKey Mouse Event in JavaScript?

Govinda Sai
Govinda Sai
Updated on 23-May-2020 276 Views

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 More

What is the role of shiftKey Mouse Event in JavaScript?

Rishi Rathor
Rishi Rathor
Updated on 23-May-2020 257 Views

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 More

What is the role of clientX Mouse Event in JavaScript?

Nancy Den
Nancy Den
Updated on 23-May-2020 443 Views

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 More

How [ ] is converted to Number in JavaScript?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 23-May-2020 234 Views

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 More

What is the role of altKey Mouse Event in JavaScript?

Sravani S
Sravani S
Updated on 23-May-2020 259 Views

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 More

Which event occurs in JavaScript when an element is content is copied to clipboard?

Nitya Raut
Nitya Raut
Updated on 23-May-2020 163 Views

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 More

What is the usage of onsearch event in JavaScript?

Abhinanda Shri
Abhinanda Shri
Updated on 22-May-2020 403 Views

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 More

What is the usage of oninvalid event in JavaScript?

Smita Kapse
Smita Kapse
Updated on 22-May-2020 319 Views

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 More

What is the usage of onfocus event in JavaScript?

Govinda Sai
Govinda Sai
Updated on 22-May-2020 632 Views

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 More

What is the usage of onblur event in JavaScript?

Nishtha Thakur
Nishtha Thakur
Updated on 22-May-2020 922 Views

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
Showing 1321–1330 of 1,508 articles
« Prev 1 131 132 133 134 135 151 Next »
Advertisements