Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Javascript Articles
Page 300 of 534
What is oncontextmenu event in JavaScript?
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 MoreUsage of border-bottom-color property in CSS
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 MoreWhat is onmouseleave event in JavaScript?
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 MoreUsage of margin-top property with CSS
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 MoreWhat is onkeydown event in JavaScript?
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 MoreUsage of border-bottom-style property in CSS
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 MoreWhat is onsubmit event in JavaScript?
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 MoreUsage of border-top-style property in CSS
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 MoreWhat are Complex Data types in JavaScript?
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 MoreHow to invoke a JavaScript Function with 'new' Function Constructor?
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