HTML Articles

Page 129 of 151

What is the role of ctrlKey Mouse Event in JavaScript?

Govinda Sai
Govinda Sai
Updated on 15-Mar-2026 292 Views

The ctrlKey mouse event property is a boolean value that indicates whether the CTRL key was pressed when a mouse event occurred. This property is available on all mouse events like click, mousedown, mouseup, etc. Syntax event.ctrlKey Return Value true - if the CTRL key was pressed during the mouse event false - if the CTRL key was not pressed during the mouse event Example The following example demonstrates how to detect if the CTRL key is pressed when clicking on an element: ...

Read More

TypedArray.byteLength property in JavaScript

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 123 Views

The byteLength property of the TypedArray object represents the length of the TypedArray in bytes. It is a read-only property that returns the size of the underlying buffer used by the typed array. Syntax typedArray.byteLength Example: Basic Usage JavaScript Example var buffer = new ArrayBuffer(156); var float32 = new Float32Array(buffer); document.write("ByteLength: " + float32.byteLength); ...

Read More

What is the role of shiftKey Mouse Event in JavaScript?

Rishi Rathor
Rishi Rathor
Updated on 15-Mar-2026 268 Views

The shiftKey property is a boolean property of mouse events that indicates whether the Shift key was pressed when the mouse event occurred. This property is commonly used to modify the behavior of mouse interactions based on keyboard modifiers. Syntax event.shiftKey Return Value The shiftKey property returns: true - if the Shift key was pressed during the mouse event false - if the Shift key was not pressed during the mouse event Example: Basic shiftKey Detection Here's how to detect if the Shift key ...

Read More

TypedArray.byteOffset property in JavaScript

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

The byteOffset property of TypedArray returns the offset (in bytes) from the start of the ArrayBuffer where the typed array begins. Syntax typedArray.byteOffset Parameters This is a property, not a method, so it takes no parameters. Return Value Returns a number representing the byte offset from the beginning of the ArrayBuffer. Example 1: TypedArray at Buffer Start JavaScript byteOffset Example var buffer = new ArrayBuffer(16); ...

Read More

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

Fendadis John
Fendadis John
Updated on 15-Mar-2026 268 Views

To set the shape of the border of the top-right corner in JavaScript, use the borderTopRightRadius property. This property allows you to create rounded corners by specifying the radius value. Syntax element.style.borderTopRightRadius = "value"; The value can be specified in pixels (px), percentages (%), or other CSS units like em or rem. Example Here's how to dynamically change the top-right border radius using JavaScript: #box { ...

Read More

How [ ] is converted to Boolean in JavaScript?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 210 Views

In JavaScript, an empty array [] is considered a truthy value when converted to Boolean. This might seem counterintuitive, but it follows JavaScript's type coercion rules for objects. Converting [] to Boolean Use the Boolean() method to explicitly convert an empty array to Boolean: Convert [] to Boolean var myVal = []; document.write("Boolean: " + Boolean(myVal)); ...

Read More

What will happen when { } is converted to String in JavaScript?

Arushi
Arushi
Updated on 15-Mar-2026 182 Views

In JavaScript, when an empty object {} is converted to a string, it becomes "[object Object]". This happens because JavaScript calls the object's toString() method during string conversion. How Object to String Conversion Works JavaScript follows these steps when converting an object to a string: First, it calls the object's toString() method For plain objects, toString() returns "[object Object]" This is the default string representation for all plain objects Example: Converting Empty Object to String Convert {} to String ...

Read More

How to return a random number between 1 and 200 with JavaScript?

Manikanth Mani
Manikanth Mani
Updated on 15-Mar-2026 2K+ Views

To return a random number between 1 and 200, use JavaScript's Math.random() and Math.floor() methods. How It Works Math.random() generates a decimal between 0 (inclusive) and 1 (exclusive). To get integers from 1 to 200: Multiply by 200 to get 0 to 199.999... Use Math.floor() to round down to 0-199 Add 1 to shift the range to 1-200 Example You can try to run the following code to return a random number in JavaScript. ...

Read More

Which is the event when the browser window is resized in JavaScript?

Nishtha Thakur
Nishtha Thakur
Updated on 15-Mar-2026 195 Views

The resize event fires when the browser window is resized. You can listen for this event using window.addEventListener() or the onresize attribute to detect window size changes. The resize Event The resize event is triggered whenever the browser window dimensions change. This includes maximizing, minimizing, or manually dragging the window borders. Method 1: Using addEventListener() Window Resize Event Window Resize Detector Resize your browser window to see the dimensions update: ...

Read More

How to search the value of the type attribute of a link in JavaScript?

Jennifer Nicholas
Jennifer Nicholas
Updated on 15-Mar-2026 254 Views

To search or retrieve the value of the type attribute of a link in JavaScript, you can use the type property of the anchor element. This attribute specifies the MIME type of the linked resource. Syntax element.type Example: Getting Type Attribute Value Qries var x = document.getElementById("qriesid").type; document.write("Value of the type attribute: " + x); ...

Read More
Showing 1281–1290 of 1,509 articles
« Prev 1 127 128 129 130 131 151 Next »
Advertisements