Front End Technology Articles

Page 7 of 652

HTML DOM Kbd Object

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 157 Views

The HTML DOM Kbd object represents the element in the document. The element is used to define keyboard input and displays text in a monospace font by default, indicating that the text represents user input from a keyboard. Syntax Following is the syntax to create a element using JavaScript − var kbdObject = document.createElement("KBD"); You can also access an existing element using − var kbdObject = document.getElementById("kbdId"); Properties The Kbd object inherits all the standard properties and methods from the HTMLElement interface. Common properties include ...

Read More

HTML DOM KeyboardEvent charCode Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 166 Views

The KeyboardEvent charCode property returns the Unicode character code of the character that was pressed during a keyboard event. It provides a numeric representation of the character, which can be useful for character validation and input processing. Note − The charCode property is deprecated. Use the key property instead for modern applications, as it provides more accurate and readable results. Syntax Following is the syntax for accessing the charCode property − event.charCode Return Value The charCode property returns a number representing the Unicode character code of the pressed key. For non-character keys ...

Read More

HTML DOM KeyboardEvent code Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 145 Views

The KeyboardEvent code property in HTML DOM returns a string representing the physical key that was pressed during a keyboard event. Unlike the key property which returns the logical key value, the code property represents the actual physical key location on the keyboard, making it useful for game controls and applications that need to detect specific key positions regardless of keyboard layout. Note − The code property is layout-independent, while the key property reflects the actual character typed. Use key for text input and code for physical key detection. Syntax Following is the syntax for accessing the ...

Read More

HTML DOM KeyboardEvent getModifierState( ) Method

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 265 Views

The getModifierState() method is a property of the KeyboardEvent interface that returns a boolean value indicating whether the specified modifier key was pressed when the keyboard event occurred. This method is essential for detecting the state of modifier keys like Ctrl, Alt, Shift, and CapsLock during user input. Syntax Following is the syntax for the getModifierState() method − event.getModifierState(keyArg) Parameters The method takes a single parameter − keyArg − A string representing the modifier key to check. The parameter is case-sensitive. Return Value The method returns a boolean ...

Read More

HTML DOM KeyboardEvent key Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 139 Views

The KeyboardEvent key property returns the identifier of the key that was pressed during a keyboard event. This property provides the actual value of the key, making it useful for detecting specific characters, special keys, and modifiers in web applications. Syntax Following is the syntax for accessing the key property − event.key Where event is the KeyboardEvent object passed to the event handler function. Return Value The key property returns a string representing the key that was pressed. The returned values include − Printable characters − Letters, numbers, symbols (e.g., ...

Read More

HTML DOM KeyboardEvent keyCode Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 129 Views

The KeyboardEvent keyCode property returns the numeric unicode character code for the key that was pressed during a keyboard event. This property has been deprecated in favor of the key property, but it is still widely used in legacy code and remains functional across browsers. Note − The keyCode property is deprecated. Use the key property instead for more accurate and readable results in modern applications. Syntax Following is the syntax for accessing the keyCode property − event.keyCode The event.keyCode returns a numeric value representing the key that was pressed. For example, the ...

Read More

HTML DOM KeyboardEvent location Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 170 Views

The HTML DOM KeyboardEvent location property returns a numeric value indicating the physical location of the pressed key on the keyboard. This property helps distinguish between keys that have the same keyCode but exist in different locations, such as left and right Shift keys. Syntax Following is the syntax for accessing the location property − event.location Return Values The property returns one of four possible numeric values representing different keyboard sections − Value Description 0 Standard keys (most keys on the keyboard including letters, numbers, ...

Read More

HTML DOM KeyboardEvent metaKey Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 156 Views

The HTML DOM KeyboardEvent metaKey property returns a Boolean value indicating whether the meta key was pressed during a keyboard event. The meta key corresponds to the Cmd key on Mac and the Windows key on Windows systems. This property is commonly used to detect keyboard shortcuts that involve the meta key, such as Cmd+C for copy on Mac or Windows+R for the Run dialog on Windows. Syntax Following is the syntax for accessing the metaKey property − event.metaKey Return Value The metaKey property returns a Boolean value − true ...

Read More

HTML DOM KeyboardEvent shiftKey Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 160 Views

The HTML DOM KeyboardEvent shiftKey property is a read-only Boolean property that indicates whether the Shift key was pressed when a keyboard event occurred. It returns true if the Shift key was held down during the event, and false otherwise. This property is commonly used to detect modified key combinations, such as Shift+Enter for line breaks or Shift+Click for multi-selection functionality. Syntax Following is the syntax for accessing the shiftKey property − event.shiftKey Return Value The property returns a Boolean value − true − The Shift key was pressed during ...

Read More

Print elements that can be added to form a given sum

Sunidhi Bansal
Sunidhi Bansal
Updated on 16-Mar-2026 276 Views

This program finds and prints elements from a given array that can be added together to form a specified sum. The algorithm uses a greedy approach where it iterates through the array and selects elements that don't exceed the remaining sum value. Algorithm The greedy algorithm works as follows − START STEP 1 → Take number of elements and array values from user STEP 2 → Take the target sum from user STEP 3 → For i = 0 to n-1 STEP 4 → If (current_sum - array[i]) >= 0 then ...

Read More
Showing 61–70 of 6,519 articles
« Prev 1 5 6 7 8 9 652 Next »
Advertisements