Web Development Articles

Page 339 of 801

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

HTML5 SVG css3 transition on fill not working when there is external link

Nancy Den
Nancy Den
Updated on 15-Mar-2026 184 Views

CSS3 transitions on SVG fill properties don't work when links are in a visited state due to browser security restrictions. Browsers limit styling capabilities for visited links to prevent privacy attacks. The Problem When an SVG element is inside a visited link, CSS transitions on the fill property are disabled by the browser. This is a security feature to prevent websites from detecting your browsing history. Solution: Adding Random Query Parameters The most effective solution is to add a random query parameter to your URLs, making each link appear "unvisited" to the browser.

Read More

How to Delete Bookmarks in your Browser (Firefox, Chrome)

Rahul Sharma
Rahul Sharma
Updated on 15-Mar-2026 344 Views

Bookmarks in web browsers allow you to save and quickly access your favorite websites. You can create a bookmark by visiting a page and pressing Ctrl+D, or by clicking the star icon in the address bar. However, over time you may want to delete bookmarks that are no longer needed. This tutorial will show you how to delete bookmarks in both Firefox and Chrome browsers using different methods. Method 1: Delete from Address Bar The quickest way to delete a bookmark is directly from the address bar when visiting the bookmarked page: In Firefox ...

Read More

HTML5 getCurrentPosition almost always failing in PhoneGap on iOS

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

When using HTML5 geolocation in PhoneGap applications on iOS devices, getCurrentPosition may fail frequently, especially on iOS 6. This issue affects location-based functionality and requires specific configuration changes to resolve. The Problem PhoneGap's geolocation API generally works well on iOS, but iOS 6 introduced specific issues where getCurrentPosition consistently triggers the failure callback instead of successfully retrieving the device's location. PhoneGap Configuration Fix The primary solution involves modifying the PhoneGap.plist file configuration: // In PhoneGap.plist, set the geolocation setting to: GeolocationEnabled: NO Setting this value to YES causes memory problems on iOS ...

Read More

How I can replace a JavaScript alert pop up with a fancy alert box?

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 1K+ Views

Creating a custom fancy alert box gives you complete control over the design and user experience. Instead of the basic browser alert, you can create styled modal dialogs using HTML, CSS, and JavaScript. Using jQuery for Custom Alert Here's a complete example that replaces the standard JavaScript alert with a custom-styled modal: function functionAlert(msg, myYes) { var confirmBox = $("#confirm"); ...

Read More

What is the best way to initialize a JavaScript number?

Prabhas
Prabhas
Updated on 15-Mar-2026 827 Views

The best way to initialize a number in JavaScript is to assign a value during variable declaration. This approach prevents undefined values and ensures your variables are ready to use immediately. Basic Number Initialization You can initialize numbers using various declaration keywords: Number Initialization // Initialize with var var deptNum = 20; var employeeId = 5; // Note: ...

Read More

Draw a circle filled with random color squares on HTML5 canvas

Sravani S
Sravani S
Updated on 15-Mar-2026 1K+ Views

When we need to fill a circle with 1x1 pixels, all with different colors in a browser, we can use HTML5 Canvas with a layered approach. Approach Drawing all pixels with random colors in a 200x200 grid on a canvas Changing composite mode to clip content Drawing circle on top to mask the random pixels Example Here's how to create a circle filled with colorful random squares: Random Color Circle ...

Read More

How to show image in alert box using JavaScript?

Nancy Den
Nancy Den
Updated on 15-Mar-2026 2K+ Views

JavaScript's default alert() function cannot display images. To show an image in an alert-like dialog, you need to create a custom modal dialog using HTML, CSS, and JavaScript. Why Default alert() Cannot Show Images The browser's built-in alert() function only accepts text strings. It cannot render HTML elements like images, making a custom solution necessary. Creating a Custom Image Alert Here's a complete example that creates a custom alert dialog with an image: ...

Read More

How do I display image in alert/confirm box in JavaScript?

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

In this tutorial, we will learn to display images in alert or confirm boxes in JavaScript. The standard alert() method displays a simple dialog box with text and an OK button, but it doesn't support images directly. To create more attractive and informative dialogs with images, we have two main approaches: Creating a custom alert box using vanilla JavaScript Using jQuery's dialog() method Method 1: Creating a Custom Alert Box This approach involves creating a custom HTML div that mimics an alert box and can contain images, styled ...

Read More

How to count the number of occurrences of a character in a string in JavaScript?

varun
varun
Updated on 15-Mar-2026 895 Views

There are several methods to count character occurrences in a JavaScript string. Here are the most effective approaches: Using a For Loop The traditional method uses a simple for loop to iterate through each character: function countCharacter(str, char) { let count = 0; for (let i = 0; i < str.length; i++) { ...

Read More
Showing 3381–3390 of 8,010 articles
« Prev 1 337 338 339 340 341 801 Next »
Advertisements