Javascript Articles - Page 531 of 607

What is the role of Keyboard Event shiftKey Property in JavaScript?

Alankritha Ammu
Updated on 23-May-2020 10:08:04

164 Views

The altkey property is used to show whether SHIFT key is pressed or not when key event was triggered.ExampleYou can try to run the following code to learn how to implement shiftKey property in JavaScript.                 Press any key                function funcShiftKey(event) {             var val = document.getElementById("res");             if (event.shiftKey) {                val.innerHTML = "SHIFT key: Pressed";             } else {                val.innerHTML = "SHIFT key: NOT Pressed";             }          }          

How to set the style of the top border with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 10:59:48

403 Views

In this tutorial, we shall learn to set the style of the top border with JavaScript. To set the style of the top border in JavaScript, use the borderTopStyle property. Set the style of the top border using this property. Let us discuss the property available in JavaScript to achieve this in brief. Using the borderTopStyle Property With the Style borderTopStyle property, we can set or return the style of the top border of an element. Syntax Following is the syntax to set the style of the top border using the borderTopStyle property in JavaScript − object.style.borderTopStyle = value; ... Read More

How -Infinity is converted to Boolean in JavaScript?

Jai Janardhan
Updated on 23-May-2020 10:06:59

234 Views

Use the Boolean() method in JavaScript to convert to Boolean. You can try to run the following code to learn how to convert -Infinity to Boolean in JavaScript.ExampleLive Demo           Convert -Infinity to Boolean                var myVal = -Infinity;          document.write("Boolean: " + Boolean(myVal));          

How [ ] is converted to String in JavaScript?

Swarali Sree
Updated on 23-May-2020 09:55:28

210 Views

Use the String() method in JavaScript to convert to String. You can try to run the following to learn how to convert [ ] to String in JavaScript.ExampleLive Demo           Convert [] to String                var myVal = [];          document.write("String: " + String(myVal));          

What is the role of shiftKey Mouse Event in JavaScript?

Rishi Rathor
Updated on 23-May-2020 09:29:49

251 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");             }          }          

What is the role of screenY Mouse Event in JavaScript?

Abhinaya
Updated on 23-May-2020 09:36:35

120 Views

When an event is triggered, the screenY mouse event returns the vertical coordinate of the mouse pointer.ExampleYou can try to run the following code to learn how to implement screenY Mouse event in JavaScript.           Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer.                      function coordsFunc(event) {             var x_coord = event.screenX;             var y_coord = event.screenY;             var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord;             document.write(xycoords);          }          

What is the role of screenX Mouse Event in JavaScript?

Anjana
Updated on 23-May-2020 09:36:05

195 Views

When an event is triggerd, the screenX mouse event returns the horizontal coordinate of the mouse pointer.ExampleYou can try to run the following code to learn how to implement screenX Mouse event in JavaScript.           Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer.                function coordsFunc(event) {             var x_coord = event.screenX;             var y_coord = event.screenY;             var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord;             document.write(xycoords);          }          

How -Infinity is converted to String in JavaScript?

Sravani Alamanda
Updated on 08-Dec-2022 09:47:04

349 Views

We all know that string is one of the primitive data types in JavaScript. JavaScript allows us to do some operations on strings like finding characters in the string, changing all characters into lowercase or into uppercase, concatenating with other strings, replacing with other strings, searching character(s) or word(s) from string, etc. We denote string in single quotations or in double quotations. typeof string variable will be a string. Syntax Syntax for String() method is, like String(value) value is required. value is JavaScript value. String() method returns a value i.e. as a string. String() method introduced ... Read More

What will happen when [50,100] is converted to Number in JavaScript?

Sai Subramanyam
Updated on 30-Jul-2019 22:30:21

156 Views

Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert [50, 100] to Number in JavaScript − Example Live Demo Convert [50,100] to Number var myVal = [50,100]; document.write("Number: " + Number(myVal));

What is the role of pageY Mouse Event in JavaScript?

Akshaya Akki
Updated on 23-May-2020 09:33:47

153 Views

When a mouse event is triggered, the pageY mouse event property is used to get the vertical coordinate of the mouse pointer. The coordinate is relative to the screen.ExampleYou can try to run the following code to learn how to implement pageY Mouse event in JavaScript.           Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer.                function coordsFunc(event) {             var x_coord = event.pageX;             var y_coord = event.pageY;             var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord;                         document.write(xycoords);          }          

Advertisements