Front End Technology Articles

Page 103 of 652

Execute a script when the browser starts to work online in HTML?

Smita Kapse
Smita Kapse
Updated on 16-Mar-2026 181 Views

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 More

Execute a script when the browser window is closed in HTML?

Prabhas
Prabhas
Updated on 16-Mar-2026 787 Views

The onunload event attribute in HTML triggers when the browser window is being closed, refreshed, or navigated away from. This event allows you to execute JavaScript code before the page is completely unloaded from memory. Syntax Following is the syntax for the onunload attribute − You can also use addEventListener in JavaScript − window.addEventListener('unload', function() { // Your code here }); Using onunload Attribute The onunload event fires when the user leaves the page by closing the browser window, clicking a link, refreshing the ...

Read More

How to include the audio/video controls in HTML?

Nancy Den
Nancy Den
Updated on 16-Mar-2026 532 Views

The controls attribute in HTML provides built-in playback controls for audio and video elements. When added to or tags, it displays a control bar with play/pause buttons, volume controls, progress bar, and other standard media controls that users expect. Syntax Following is the syntax for the controls attribute − The controls attribute is a boolean attribute, meaning it does not require a value. Its presence enables the controls, while its absence disables them. Video Controls The controls ...

Read More

Execute a script when the user writes something in a search field in HTML?

Ankith Reddy
Ankith Reddy
Updated on 16-Mar-2026 249 Views

The onsearch attribute in HTML allows you to execute a JavaScript function when the user performs a search action in a search input field. This event triggers when the user presses ENTER or clicks the clear button (×) in browsers that support it. Syntax Following is the syntax for the onsearch attribute − The onsearch attribute calls a JavaScript function when a search event occurs on the search input field. Example − Basic Search Event Following example demonstrates how to use the onsearch attribute to capture search input − ...

Read More

How to specify the URL of the resource to be used by the object in HTML?

Sreemaha
Sreemaha
Updated on 16-Mar-2026 206 Views

The data attribute in HTML is used to specify the URL of the resource to be used by the element. This attribute defines the location of external content such as images, videos, audio files, Flash files, PDFs, or other multimedia resources that should be embedded in the web page. Syntax Following is the syntax for the data attribute − Alternative content The data attribute accepts a valid URL pointing to the resource file. The URL can be relative (pointing to a file in the same domain) or absolute ...

Read More

How to set the audio output of the video to mute in HTML?

Sreemaha
Sreemaha
Updated on 16-Mar-2026 478 Views

Use the muted attribute to set the audio output of the video to mute in HTML. The muted attribute is a boolean attribute that specifies whether the video's audio should be initially silenced when the page loads. Syntax Following is the syntax for the muted attribute − The muted attribute can be written in three ways − muted − Boolean attribute (recommended) muted="muted" − Explicit value muted="" − Empty value How It Works When the muted attribute is present, the video element will start ...

Read More

Set the shape of the area in HTML

mkotla
mkotla
Updated on 16-Mar-2026 209 Views

The shape attribute in HTML defines the clickable area's geometry within an image map. It works with the element to create interactive regions on images that users can click to navigate to different links. Syntax Following is the syntax for the shape attribute − The shape attribute accepts four possible values: rect, circle, poly, and default. Each shape type requires specific coordinate formats. Shape Values and Coordinates The following table shows the valid shape values and their coordinate requirements − Shape Value Coordinates Format Description ...

Read More

Execute a script when a user navigates to a page in HTML?

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 16-Mar-2026 309 Views

The onpageshow event in HTML allows you to execute a script whenever a user navigates to a page. This event fires every time a page loads, including when users navigate back using the browser's back button or reload the page. HTML onpageshow Event The onpageshow event occurs when a user navigates to a webpage. Unlike the onload event, onpageshow fires even when the page is loaded from the browser cache, making it ideal for initialization scripts that need to run every time the page is displayed. Syntax Following is the syntax for the onpageshow event in ...

Read More

Execute a script before the document is printed in HTML?

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 425 Views

The onbeforeprint attribute in HTML is an event handler that executes a JavaScript function before a document is printed. This attribute triggers when the user attempts to print the page through browser print functionality (Ctrl+P, File → Print, or print button), displaying custom messages or performing actions before the print dialog appears. The onbeforeprint event is commonly used together with the onafterprint attribute to handle print preparation and cleanup tasks. It belongs to the HTML event attributes category and can be applied to the element or used with JavaScript event listeners. Syntax Following is the syntax ...

Read More

Set the text wrap in a form in HTML

Nikitha N
Nikitha N
Updated on 16-Mar-2026 861 Views

The wrap attribute in HTML controls how text wrapping behaves in a element. This attribute determines whether line breaks are inserted when the text reaches the edge of the textarea and how those line breaks are handled when the form is submitted to the server. Syntax Following is the syntax for the wrap attribute − Text content The value can be soft, hard, or off. Wrap Attribute Values The wrap attribute accepts three possible values − soft − Text wraps visually in the textarea, but line breaks are not ...

Read More
Showing 1021–1030 of 6,519 articles
« Prev 1 101 102 103 104 105 652 Next »
Advertisements