Found 2418 Articles for HTML

Execute a script when the document is about to be unloaded in HTML?

Nishtha Thakur
Updated on 03-Mar-2020 12:20:33

108 Views

The onbeforeunload event attribute’ fires when the document is ready to be unloaded.ExampleYou can try to run the following code to implement the onbeforeunload attribute −           Close this window or press F5.                function display() {             return "Wanna stay here or leave?";          }          

Execute a script before the document is printed in HTML?

Yaswanth Varma
Updated on 16-Dec-2022 10:25:32

194 Views

The task we are going to perform in this article is execute a script before the document is printed in HTML. When a page is about to be printed, the HTML onbeforeprint attribute is used. And before the print dialogue box appears, the alert message is displayed. Together with the onafterprint attribute, the onbeforeprint attribute is utilised. This is a part of event attribute. Let’s dive into the following examples to understand more about to execute a script before the document is printed in HTML. Example 1 In the following examples we are using HTML onbeforeprint attribute. ... Read More

How do we include the legal number intervals for an input field in HTML?

radhakrishna
Updated on 03-Mar-2020 11:23:06

238 Views

Use the step attribute to include the legal number intervals for an input field in HTML. The HTML input type step attribute sets the legal number intervals. Steps are number steps like 0, 5, 10, 15, 20, etc. The step attribute can be used together with the max and min attributes to create a range of legal values.ExampleYou can try to run the following code to implement step attribute −           HTML input step attribute                                            

How to specify the URL of the image to use in different situations in HTML?

Smita Kapse
Updated on 03-Mar-2020 11:25:00

238 Views

Use the srcset attribute to specify the URL of the image to use in different situations in HTML.ExampleYou can try to run the following code to implement srcset attribute. Resize the browser to see different images loading −                                                                

Set the language of the track text data in HTML

Abhinanda Shri
Updated on 03-Mar-2020 11:25:44

99 Views

Use the srclang attribute to set the language of the track text data in HTML. For subtitles, use this attribute.ExampleYou can try to run the following code to implement srlang attribute −                                                            Your browser does not support the video element.          

Set the start value of an ordered list in HTML?

mkotla
Updated on 03-Mar-2020 11:24:10

383 Views

Use the start attribute to set the start value of an ordered list in HTML i.e.Add the value of where you want to start above.ExampleYou can try to run the following code to implement the start attribute −           HTML ol Tag               Programming Languages Rank Usage:                Java          C++          C          

How to specify the HTML content of the page to show in the <iframe> in HTML?

Nikhilesh Aleti
Updated on 05-Jul-2024 14:32:46

3K+ Views

In this article, we need to display the HTML content of the page in an iframe; A browser window divided as a separate page. We can achieve this task using the tag and it’s srcdoc attribute. HTML tag The tag in HTML specifies an inline frame. This inline frame is used to embed another document within the current HTML document. This tag is supported by every browser such as Google Chrome, Microsoft edge/ internet explorer, Firefox, safari, and opera, etc. The “srcdoc” attribute of the tag is used to specify the HTML content of the page ... Read More

Execute a script when the user pastes some content in an element in HTML?

Yaswanth Varma
Updated on 16-Dec-2022 10:23:36

89 Views

In this article, we are going to execute a script when the user pastes content into an element in HTML. When a user pastes content into an element, the onpaste event is triggered. Although all HTML elements accept the onpaste event, you cannot actually paste information into a element, unless the element has set contenteditable to "true." Most components with type="text" employ the onpaste event.Let’s dive into the following examples to get better understanding on executing a script when the user pastes some content in an element in HTML. Example 1 In the following examples we are using ... Read More

How to set the URL of the media file in HTML?

Yaswanth Varma
Updated on 16-Dec-2022 11:11:27

554 Views

In this article, we are going to learn about how to set the URL of the media fiel in HTML. Here, we'll look at how to use HTML to establish a media file's URL. We utilise the tag to specify a media file's URL. Multimedia files, including audio, video, and image files, are attached using this tag. The element is contained in the , , and elements. Syntax Following is the syntax for element ……. Let’s dive into the following examples to understand more about how to set the URL of the media file in HTML. ... Read More

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

Nikhilesh Aleti
Updated on 08-Nov-2022 07:59:00

149 Views

The task we need to perform in this article is executing a script when a user navigates to a page in HTML. We can do the above task (executing a script when a user navigates to a page in HTML) by using "onpageshow Event". Before we jump into the examples let’s look into the definition and usage of onpageshow event in HTML. HTML onpageshow event The onpageshow event in HTML occurs when a user navigates to a webpage. This event occurs every time the page is loaded. Syntax Following is the syntax of onpageshow event in HTML − ... Read More

Advertisements