Javascript Articles - Page 579 of 671

How to attach one or more drop-shadows to the box with JavaScript?

Saurabh Jaiswal
Updated on 06-Jan-2023 13:26:42

2K+ Views

To attach one or more drop shadows to a box with JavaScript, you can use the box-shadow style property. You can specify the shadow's offset, blur radius, spread radius, and color by passing values for these properties in the box-shadow property. Syntax Following is the syntax to add one or more drop shadows to the box with JavaScript − box.style.boxShadow = "offset-x offset-y blur-radius spread-radius color"; Here the box.style.boxShadow property in JavaScript allows you to add one or more drop shadows to a box element. It takes the following parameters offset-x − This is the horizontal offset of ... Read More

Which event occurs in JavaScript when the dragging of an element begins?

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

176 Views

The ondragstart event triggers when dragging of an element begins.You can try to run the following code to learn how to implement ondragstart JavaScript event − Example Live Demo .drag { float: left; width: 100px; height: 35px; ... Read More

How null is converted to Number in JavaScript?

Saurabh Jaiswal
Updated on 11-Aug-2022 12:38:34

10K+ Views

In JavaScript null is a predefined keyword that represents an empty value or unknown value of no value. The data type of null is an object. In this article, we will learn how to convert null into Boolean using multiple approaches which are following. Using Number() Method Using Logical OR (||) Using the ~~ operator Using Ternary Operator Concatenating null with a boolean value Using the Number() Method The Number() method in JavaScript is used to convert a value into a number. If the value is not convertible, then it will return NaN. To convert the null into ... Read More

Which event occurs in JavaScript when an element is getting dragged?

Anvi Jain
Updated on 22-May-2020 11:28:34

149 Views

Use the ondrag event in JavaScript to drag an element. The ondrag event is triggered when an element is dragged.ExampleYou can try to run the following code to learn how to work with ondrag event in JavaScript.                    .drag {             float: left;             width: 100px;             height: 35px;             border: 2px dashed #876587;             margin: 15px;             padding: 10px;     ... Read More

What is the usage of onsearch event in JavaScript?

Abhinanda Shri
Updated on 22-May-2020 11:28:01

371 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);          }          

What is the usage of onreset event in JavaScript?

Anjana
Updated on 23-Jun-2020 09:08:43

374 Views

The onreset event is useful when a form is reset. You can try to run the following code to learn how to implement onreset event in JavaScript −Example                    function resetFunct() {             alert("The form was reset");          }                      Enter age:          Enter birth month:                    

How to set the amount by which the border image area extends beyond the border box with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 11:29:02

186 Views

In this tutorial, we will learn how to set a number up by which the border image area extends beyond the border box in JavaScript. To set the amount by which the border image is extended, you need to set the border outside edges. To do this we can apply the borderImageOutset style property provided in JavaScript. After creating a border image area for the HTML element, we might have to increase the area. By knowing a method to increase the border image area more than the border box, we can make the change without writing lengthy code. ... Read More

What is the usage of oninvalid event in JavaScript?

Smita Kapse
Updated on 22-May-2020 11:17:18

283 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:                              

How to set the widths of the image border with JavaScript?

Shubham Vora
Updated on 25-Oct-2022 10:23:45

485 Views

In this tutorial, we shall learn to set the widths of the image border with JavaScript. To set the widths of the image border, use the borderImageWidth property in JavaScript. When we need an image as a border of our webpage content, we have to see how to set the width of the image border. Let us discuss the option to achieve this in brief. Using the Style borderImageWidth Property With the Style borderImageWidth property, we can set or return the widths of the image border of an element. The border image will range beyond the padding when the border ... Read More

What is the usage of oninput event in JavaScript?

Sai Nath
Updated on 23-Jun-2020 09:06:13

365 Views

When a value is added in an input box, then the oninput event occurs. You can try to run the following code to learn how to implement oninput event in JavaScript −Example           Write below:                            function inputFunc() {             var a = document.getElementById("newInput").value;             document.write("Typed: " + a);          }          

Advertisements