Javascript Articles

Page 300 of 534

What is oncontextmenu event in JavaScript?

usharani
usharani
Updated on 15-Mar-2026 543 Views

The oncontextmenu event in JavaScript triggers when a user right-clicks on an element, causing the context menu to appear. This event allows you to handle right-click interactions and can be used to customize or prevent the default context menu behavior. Syntax element.oncontextmenu = function() { // Handle right-click }; // Or using addEventListener element.addEventListener('contextmenu', function(event) { // Handle right-click }); Example: Basic Context Menu Event Here's how to handle the oncontextmenu event when a user right-clicks on an element: ...

Read More

Usage of border-bottom-color property in CSS

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 72 Views

The border-bottom-color CSS property sets the color of an element's bottom border. It only affects the color when a border style is already defined. Syntax border-bottom-color: color | transparent | inherit; Parameters The property accepts these values: color - Any valid CSS color value (hex, RGB, named colors) transparent - Makes the border invisible inherit - Inherits the color from parent element Example: Basic Usage ...

Read More

What is onmouseleave event in JavaScript?

Sreemaha
Sreemaha
Updated on 15-Mar-2026 347 Views

The onmouseleave event triggers when the mouse pointer moves out of an element. It fires only when the mouse completely leaves the element boundary. Syntax element.onmouseleave = function() { // Code to execute when mouse leaves }; // Or using addEventListener element.addEventListener('mouseleave', function() { // Code to execute }); Example: Basic Mouse Leave Event Here's how to implement the onmouseleave event: function sayHello() { ...

Read More

Usage of margin-top property with CSS

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 91 Views

The margin-top property specifies the top margin of an element in CSS. It creates space above an element, pushing it away from adjacent elements or the container's edge. Syntax margin-top: value; Values Length: Fixed values like 10px, 2em, 1rem Percentage: Relative to parent's width (e.g., 10%) auto: Browser calculates automatically inherit: Inherits from parent element Example: Fixed Values ...

Read More

What is onkeydown event in JavaScript?

Priya Pallavi
Priya Pallavi
Updated on 15-Mar-2026 459 Views

The onkeydown event in JavaScript triggers when a user presses down a key on the keyboard. This event occurs before the key is released and before the character appears in the input field, making it useful for intercepting keystrokes and implementing custom keyboard behaviors. Syntax element.onkeydown = function(event) { // Handle keydown event }; // Or using addEventListener element.addEventListener('keydown', function(event) { // Handle keydown event }); Basic Example Onkeydown Example ...

Read More

Usage of border-bottom-style property in CSS

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 198 Views

The border-bottom-style property defines the style of an element's bottom border. It accepts various values like solid, dashed, dotted, and more to create different visual effects. Syntax border-bottom-style: value; Available Values The property accepts the following values: none - No border (default) solid - A solid line dashed - A dashed line dotted - A dotted line double - Two solid lines groove - A 3D grooved border ridge - A 3D ridged border inset - A 3D inset border outset - A 3D outset border Example: Basic Usage ...

Read More

What is onsubmit event in JavaScript?

V Jyothi
V Jyothi
Updated on 15-Mar-2026 4K+ Views

The onsubmit event is an event that occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here we are calling a validate() function before submitting a form data to the web server. If validate() function returns true, the form will be submitted, otherwise, it'll not submit the data. Syntax // form elements // Or using JavaScript form.onsubmit = function(event) { // validation logic return true; ...

Read More

Usage of border-top-style property in CSS

Samual Sam
Samual Sam
Updated on 15-Mar-2026 174 Views

The border-top-style property changes the style of the top border of an element. This CSS property allows you to define different visual styles for the top border, such as solid, dashed, dotted, and more. Syntax border-top-style: value; Available Values The border-top-style property accepts the following values: none - No border (default) solid - A solid line dashed - A dashed line dotted - A dotted line double - Two solid lines groove - A 3D grooved border ridge - A 3D ridged border inset - A 3D inset border outset - A ...

Read More

What are Complex Data types in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 3K+ Views

In this tutorial, we will learn about complex data types in JavaScript. JavaScript has multiple built-in data types to store data in different formats. The data types of JavaScript can be divided into two groups: primitive data types and non-primitive data types. Number, String, Boolean, Undefined and Null are primitive data types, whereas Array and Object are non-primitive data types. The typeof operator is used to identify data types. The primitive data types are simple and easy to use. In contrast, the non-primitive data types (Array and Object) are relatively more complex than primitive data types, so the ...

Read More

How to invoke a JavaScript Function with 'new' Function Constructor?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 873 Views

In this tutorial, we will learn how to invoke a JavaScript Function with the 'new' Function Constructor. Functions are a set of reusable codes that perform a specific task and may return a value. In JavaScript, functions are defined by the keyword function. A function may not have any parameters and may also not have any return statement. In JavaScript, we also have functions with no function names, called anonymous functions. Using the 'new' Function Constructor The Function constructor makes a new Function object. By using the constructor, we can create a function dynamically. It takes parameters, ...

Read More
Showing 2991–3000 of 5,340 articles
« Prev 1 298 299 300 301 302 534 Next »
Advertisements