Giri Raju

Giri Raju

66 Articles Published

Articles by Giri Raju

Page 2 of 7

How to format hexadecimal Number in JavaScript?

Giri Raju
Giri Raju
Updated on 15-Mar-2026 2K+ Views

JavaScript provides several methods to format hexadecimal numbers. The most common approach is using toString(16) to convert numbers to hexadecimal format, then applying padding and formatting as needed. Basic Hexadecimal Conversion The toString(16) method converts a number to its hexadecimal representation: let num = 255; let hex = num.toString(16); document.write("Number: " + num + ""); document.write("Hexadecimal: ...

Read More

How I can show JavaScript alert box in the middle of the screen?

Giri Raju
Giri Raju
Updated on 15-Mar-2026 2K+ Views

The native JavaScript alert() box cannot be repositioned as its styling and position are controlled by the browser. To show an alert box in the center of the screen, you need to create a custom alert dialog using HTML, CSS, and JavaScript. Why Native alert() Can't Be Centered The built-in alert() function displays a browser-controlled modal that appears at a fixed position determined by the browser, typically near the top of the viewport. This position cannot be customized through CSS or JavaScript. Creating a Custom Centered Alert Box Here's how to create a custom alert that ...

Read More

Why does the JavaScript void statement evaluate an expression?

Giri Raju
Giri Raju
Updated on 15-Mar-2026 147 Views

The JavaScript void operator evaluates an expression and always returns undefined, regardless of what the expression returns. This is useful for preventing unwanted side effects in web pages. What is the void Operator? The void operator takes any expression, evaluates it, and returns undefined. It's commonly used in links to prevent navigation while still executing JavaScript code. Syntax void expression void(expression) Example: Using void(0) in Links The most common use case is void(0) in hyperlinks to prevent page navigation: Understanding JavaScript void(0) ...

Read More

How can I make a browser to browser (peer to peer) connection in HTML?

Giri Raju
Giri Raju
Updated on 15-Mar-2026 538 Views

Creating browser-to-browser (peer-to-peer) connections in HTML can be achieved using WebRTC technology. The PeerJS library simplifies this process by providing an easy-to-use API for establishing P2P connections. Include the PeerJS Library First, include the PeerJS library in your HTML file: Create a Peer Connection Initialize a new peer with a unique ID. PeerJS provides free public servers, so no API key is required: // Create a new peer with a unique ID var peer = new Peer('peer-' + Math.floor(Math.random() * 1000)); // Listen for incoming connections peer.on('connection', function(conn) ...

Read More

HTML 5 video or audio playlist

Giri Raju
Giri Raju
Updated on 15-Mar-2026 858 Views

HTML5 provides the onended event that fires when audio or video playback completes. This event is essential for creating video playlists, showing completion messages, or automatically loading the next media file. Basic onended Event Example The onended event allows you to execute JavaScript when media playback finishes. Here's a simple example that shows a message: Your browser does not support the video ...

Read More

Usage of font-style property in CSS

Giri Raju
Giri Raju
Updated on 15-Mar-2026 97 Views

The font-style property in CSS is used to specify whether text should be displayed in normal, italic, or oblique style. This property allows you to add emphasis to text by changing its visual appearance. Syntax font-style: normal | italic | oblique; Values normal - Default value. Text is displayed normally italic - Text is displayed in italic style (slanted) oblique - Text is displayed in oblique style (artificially slanted) Example: Basic Font Style Usage ...

Read More

The correct way to work with HTML5 checkbox

Giri Raju
Giri Raju
Updated on 15-Mar-2026 252 Views

HTML5 checkboxes allow users to select multiple options from a list. The correct syntax uses the input element with type="checkbox". Syntax Basic Example Here's a simple checkbox form with labels: HTML5 Checkbox Example Mathematics ...

Read More

Font size adjust of an element with CSS

Giri Raju
Giri Raju
Updated on 15-Mar-2026 262 Views

The font-size-adjust CSS property enables you to adjust the x-height to make fonts more legible when fallback fonts are used. It helps maintain consistent visual font sizes across different font families. Syntax font-size-adjust: none | number; Parameters none - Default value. No font size adjustment. number - A positive number that specifies the aspect ratio (x-height divided by font size). How It Works The property calculates: adjusted font size = specified font size × (font-size-adjust value ÷ aspect ratio of actual font) ...

Read More

How to give a warning for Non-JavaScript Browsers?

Giri Raju
Giri Raju
Updated on 15-Mar-2026 306 Views

To warn users about non-JavaScript browsers, use the tag. The HTML tag handles browsers that recognize tags but have JavaScript disabled or don't support scripting. This tag displays alternate content when JavaScript is unavailable. Syntax Content to display when JavaScript is disabled Basic Example Here's how to provide a warning message for users without JavaScript: JavaScript Warning Example document.write("Hello JavaScript!"); ...

Read More

How to create a line break with JavaScript?

Giri Raju
Giri Raju
Updated on 15-Mar-2026 42K+ Views

To create a line break with JavaScript, we have three different approaches depending on your use case and HTML structure. In this article, we'll explore how to create line breaks using the tag, the newline character, and the insertAdjacentHTML() method with block elements. Each method has specific applications and benefits. Approaches to Create a Line Break with JavaScript Using tag with DOM manipulation Using newline character () Using insertAdjacentHTML() with block elements Using tag with DOM manipulation ...

Read More
Showing 11–20 of 66 articles
« Prev 1 2 3 4 5 7 Next »
Advertisements