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
Articles by Smita Kapse
388 articles
Limited-Contention Protocols
Limited Contention Protocols are media access control (MAC) protocols that combine the advantages of collision-based protocols and collision-free protocols. They behave like slotted ALOHA under light loads and bitmap protocols under heavy loads, adapting dynamically to network conditions. How It Works In computer networks, when multiple stations try to transmit simultaneously via a shared channel, the transmitted data becomes garbled in an event called collision. Limited contention protocols address this by using an adaptive approach: Under light loads − Behave like slotted ALOHA where all stations can compete freely for transmission slots Under ...
Read MoreExecute a script when the browser starts to work online in HTML?
The ononline event attribute in HTML executes a JavaScript function when the browser detects that it has regained internet connectivity. This event is fired when the browser transitions from offline to online mode, making it useful for handling network state changes in web applications. Syntax Following is the syntax for the ononline attribute − The ononline attribute is typically used on the element and calls a JavaScript function when the browser goes online. How It Works The browser monitors network connectivity and fires the online event when: The ...
Read MoreHow to play sound file in a web-page in the background?
The HTML audio element is the modern standard for adding audio to web pages. To play a sound file in the background automatically when a page loads, you can use the element with the autoplay and loop attributes. The element can also be used but is less recommended for modern web development. Syntax Following is the syntax for the HTML audio element − Your browser does not support the audio element. Following is the syntax for the embed element ...
Read MoreHow to specify the HTTP method to use when sending form-data in HTML?
The method attribute in HTML forms specifies the HTTP method to use when sending form data to the server. This attribute determines how the browser packages and transmits the form data when the user submits the form. Syntax Following is the syntax for the method attribute − The value can be either get or post, with get being the default if not specified. HTTP Methods HTML forms support two primary HTTP methods − GET Method The GET method appends form data to the URL as ...
Read MoreHow to specify the URL of the image to use in different situations in HTML?
Use the srcset attribute to specify the URL of the image to use in different situations in HTML. This attribute allows you to provide multiple image sources for responsive images, enabling browsers to choose the most appropriate image based on screen size, resolution, or other conditions. Syntax The srcset attribute can be used in two main ways − Using srcset with img Element The srcset attribute on the element allows you to specify multiple image sources with their respective widths or pixel densities. The browser automatically selects ...
Read MoreHow to specify whether the or the element should have autocomplete enabled in HTML?
The autocomplete attribute in HTML controls whether the browser should automatically suggest previously entered values for form fields. This feature helps users fill forms more efficiently by displaying a dropdown of suggested values based on their input history. Syntax Following is the syntax for the autocomplete attribute on the element − Following is the syntax for the autocomplete attribute on the element − Autocomplete Values The autocomplete attribute accepts the following values − Value Description ...
Read MoreExecute a script when the seeking attribute is set to true indicating that seeking is active in HTML?
The onseeking event attribute in HTML is triggered when the user starts seeking (moving to a different position) in an audio or video element. This event fires when the seeking process begins, before the media actually jumps to the new position. Syntax Following is the syntax for the onseeking event attribute − The onseeking attribute accepts a JavaScript function that executes when the seeking operation starts. This is commonly used to provide user feedback or track user interactions with media content. How It Works When a user drags the progress ...
Read MoreHow to draw circle in HTML page?
To draw a circle in HTML page, use SVG, HTML5 Canvas, or CSS. The most common approach is using CSS with the border-radius property set to 50% on a square element. SVG provides more control for complex graphics, while Canvas allows dynamic drawing with JavaScript. Using CSS Border-Radius The simplest method to create a circle is using CSS. Set equal width and height on an element, then apply border-radius: 50% to make it perfectly circular. Example − Basic CSS Circle CSS Circle ...
Read MoreHow to set how the last line of a block or a line right before a forced line break is aligned when text-align is "justify" with JavaScript?
The textAlignLast property in JavaScript controls how the last line of a text block is aligned when the text uses text-align: justify. This is particularly useful for controlling the alignment of the final line in justified paragraphs. Syntax element.style.textAlignLast = "value"; Common Values The textAlignLast property accepts these values: auto - Default behavior (usually left-aligned) left - Aligns last line to the left right - Aligns last line to the right center - Centers the last line justify - Justifies the last line (stretches it) Example: Setting Last Line Alignment ...
Read MoreMake HTML5 input type="number" accepting dashes
To allow HTML5 input fields to accept dashes along with numbers, you cannot use type="number" directly since it only accepts numeric characters. Instead, use type="text" with a pattern attribute to validate the input format. The Problem with type="number" HTML5 input type="number" strictly accepts only numeric values and will reject any non-numeric characters including dashes. To accept dashes, we need to use type="text" with pattern validation. Solution Using Pattern Attribute Use the pattern attribute with a regular expression to validate numbers with dashes: Number Input with Dashes ...
Read More