Javascript Articles

Page 290 of 534

What are the essential tags for an HTML Document?

Shakira Thasleem
Shakira Thasleem
Updated on 15-Mar-2026 2K+ Views

HTML (HyperText Markup Language) is the standard markup language for creating web pages and web applications. Understanding the essential HTML tags is crucial for building properly structured documents that browsers can interpret correctly. An HTML tag consists of three components: an opening tag that marks the start, content that displays in the browser, and a closing tag marked with a forward slash like . All HTML tags should be written in lowercase for best practices. Note: Some HTML tags are self-closing and don't require a closing tag, such as and . Every HTML document requires four ...

Read More

How to use the tag to define a relationship to an external resource?

Johar Ali
Johar Ali
Updated on 15-Mar-2026 316 Views

The tag is used in HTML to define a relationship to an external resource. It is most commonly used to link external style sheets to HTML documents. The tag is placed inside the section and is a self-closing tag, meaning it does not require a closing tag. Syntax Key Attributes The tag uses several important attributes: rel - Specifies the relationship between the current document and the linked resource href - Specifies the URL of the external resource type - Specifies the media type of the linked resource ...

Read More

Set the background color of an element with CSS

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 448 Views

To set the background color of an element, use the background-color property in CSS. This property accepts color values in various formats including color names, hex codes, RGB, and HSL values. Syntax background-color: color-value; Example Here's how to set background colors using different methods: Background Color Example This text has a blue background color. ...

Read More

How to include inline JavaScript inside an HTML page?

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

In this tutorial, we will learn how to include inline JavaScript inside an HTML page. Inline JavaScript allows you to write JavaScript code directly within HTML event attributes, making it useful for simple interactions without external script files. Using Inline JavaScript to Show an Alert Message One of the simplest ways to understand inline JavaScript is by using the alert method. The alert method opens a pop-up window containing a message. Inline JavaScript code is written within event attributes and executes when that event is triggered. Syntax // inline JavaScript within the onclick attribute of ...

Read More

How to call a JavaScript function on a click event?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 25K+ Views

To call a function on click event in JavaScript, you can use either the addEventListener method or the onclick event attribute. The addEventListener method is a general way to attach an event handler to a DOM element, and it allows you to specify the event and the callback function to be called when the event occurs. The onclick attribute is a specific event attribute that allows you to specify a JavaScript function to be called when the element is clicked. Both methods allow you to specify a function to be called when the element is clicked, but the addEventListener ...

Read More

How to integrate Google AdSense into your webpage?

Anjana
Anjana
Updated on 15-Mar-2026 526 Views

If your website has sufficient content and good page views, you can start adding advertisements to earn money. Google AdSense is a free and easy way to monetize your website by displaying targeted ads. Integrating Google AdSense involves both account setup and technical implementation. Let's explore the complete process. Setting Up Your AdSense Account Follow these steps to create and configure your AdSense account: Go to the official AdSense website and sign in with your Google Account. Set up your account with all required details including website ...

Read More

Set the Background Image Position with CSS

mkotla
mkotla
Updated on 15-Mar-2026 626 Views

To set the background image position, use the background-position property. This CSS property controls where the background image is positioned within its container element. Syntax background-position: horizontal vertical; The property accepts various values including pixels, percentages, and keywords like left, right, center, top, and bottom. Example: Positioning with Pixels This example sets the background image position 80 pixels from the left and centers it vertically: body { ...

Read More

How do we upload external file on a website using HTML forms?

radhakrishna
radhakrishna
Updated on 15-Mar-2026 5K+ Views

If you want to allow a user to upload an external file to your website, you need to use a file upload box, also known as a file select box. This is created using the element with the type attribute set to file. HTML File Upload Form Choose file... Browse No file chosen Basic File Upload Example Here's a simple HTML form with a file upload input: File ...

Read More

How to use the submit button in HTML forms?

mkotla
mkotla
Updated on 15-Mar-2026 5K+ Views

Submit button automatically submits a form on click. Using HTML forms, you can easily take user input. The tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc. Let's learn about how to use the submit button in HTML forms. It is created using HTML tag with the type attribute set to "submit". HTML Form with Submit Button ...

Read More

How to preselect a list item using JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 320 Views

In this tutorial, we will learn how to preselect a select list item using JavaScript. This is useful when you want to set a default selection dynamically based on user preferences or application state. The HTML element creates dropdown menus where users can choose from multiple options. Each element represents a selectable choice. You can preselect options either by adding the selected attribute in HTML or programmatically using JavaScript. Understanding Select Elements A select element consists of: id attribute - Associates with labels for accessibility name attribute - ...

Read More
Showing 2891–2900 of 5,340 articles
« Prev 1 288 289 290 291 292 534 Next »
Advertisements