Javascript Articles - Page 576 of 671

How to set the shape of the border of the top-right corner with JavaScript?

Fendadis John
Updated on 23-May-2020 10:08:48

232 Views

To set the shape of the border of the top-right corner in JavaScript, use the borderTopRightRadius property. Set border radius using this property.ExampleYou can try to run the following code to learn how to set the shape of the top-right border with JavaScript.Live Demo                    #box {             border: thick solid gray;             width: 300px;             height: 200px          }                     Demo Text             Change top right border radius                function display() {             document.getElementById("box").style.borderTopRightRadius = "20px";          }          

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

Ankitha Reddy
Updated on 30-Jul-2019 22:30:21

172 Views

The ctrlKey property is used to show whether the CTRL key is pressed or not when key event was triggered. You can try to run the following code to learn how to implement a ctrlKey property in JavaScript − Example Live Demo Press any key function funcCtrlKey(event) { var val = document.getElementById("res"); if (event.ctrlKey) { val.innerHTML = "CTRL key: Pressed"; } else { val.innerHTML = "CTRL key: NOT Pressed"; } }

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

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

138 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

347 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

197 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

177 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

214 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

95 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

169 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

263 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

Advertisements