Display Document Last Modified Date and Time in JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 08:04:49

2K+ Views

In this article we are going to discuss how to display the date and time of a document when it is last modified in JavaScript. It is important to know the last updated date and time of a web document, when you read some content on the web, to know whether the web document is latest or outdated. The Document object has lastModified property which returns us the last modified date and time of a document. This is a read-only property. The value of the lastModified property is obtained by the HTTP header from the web server. For people who ... Read More

Find Accept-Charset and Enctype Attributes of a Form in JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 08:03:14

424 Views

In this article we are going to discuss how to find the accept-charset and enctype attribute of a form in JavaScript. In HTML, there is a element which has few attributes − input, label, text area, select, name, target. The accept-charset is used to return the set of one or more encoding types for the HTML document. This attribute also specifies the character encodings that are to be used for the form submission. The enctype is used to specify how the form-data is encoded. Using acceptCharset attribute The acceptCharset attribute in JavaScript will display the acceptable charset values. Syntax ... Read More

Find Name and Target of a Form in JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 08:01:44

1K+ Views

In this article we are going to learn how to find the name and the target of a form in JavaScript. In HTML, there is element which has few attributes: input, label, text area, select, name, target. The name and target attributes of form are used to find those elements in JavaScript. The name attribute is used to return the name of the form. The target attribute is used to check whether the result will open in the same window or new window or new frame, when the form is submitted. The possible values for target are blank, _self, ... Read More

Get Cookies Associated with a Document in JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 08:00:28

657 Views

In this article we are going to learn how to get the cookies associated with a document in JavaScript. The cookies property present in the Document interface is used to return the cookies associated with a Document in JavaScript. The Cookies are small strings of data that is present in the form of name=value pairs inside a browser. Each cookie is delimited by a ‘;’. Cookies are used for client-server applications. Cookies have an expiration date. They have a size limit of 4KB. To get a better understanding of this concept, let’s look into the examples further in this article. ... Read More

Display Server Domain of Loaded Document in JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 07:58:49

489 Views

In this following article we are going to learn how to display the domain of the server that loaded a document in JavaScript. To display the domain of the server, we use domain property of the document interface, which returns the domain part of the current document. The domain property will return NULL if the document was created in memory. Attempting to set the domain property of the document interface results in SecurityError. To understand better, let’s look into the syntax and usage of domain property with suitable examples in JavaScript. Using domain property We can get the domain name ... Read More

Find Href Attribute of a Link in JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 07:56:56

3K+ Views

In this following article we are going to learn how to find the href attribute of a link in a document in JavaScript. The DOM property in the JavaScript provides many properties like , , , , , . There are two ways we can represent the links in HTML DOM. The DOM object provides links property. The href attribute in the anchor tag specifies the URL. To get the href attribute, we need to find the anchor object reference. To get a better idea of this concept, let’s look into the syntax and usage of the href attribute of ... Read More

Find the Number of Links in a Document using JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 07:55:38

1K+ Views

In this article we are going to discuss how to find the number of links in a document in JavaScript. The DOM property in the JavaScript provides many properties like , , , , , . There are two ways through which we can represent the links in HTML DOM. The DOM object provides links property. The document.links property provides us a collection of and tags inside a document. The document.links property is similar to an array. We can access any property (like href, name, title) of the links using this property. To find the total number of ... Read More

Get a Particular Anchor in a Document Using JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 07:54:19

2K+ Views

In this article we will learn how to get a particular anchor in a document in JavaScript. The Javascript anchor tags follow an array-like structure. When we try to display a particular anchor tag we have to use ,document.anchors.innerHTML method. This method works the same as array methods which are used to display a particular element. To get a better understanding let’s look into the usage and syntax of anchor tag in JavaScript. Syntax The syntax to get a particular anchor tag is shown below. document.anchors[i].innerHTML or document.getElementsByTagName(“a”)[i].innerHTML Example 1 The following is an example program to get a ... Read More

Find Number of Anchors in a Document using JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 07:52:56

1K+ Views

This article discusses about how to find the number of anchors in a document in JavaScript. The anchor tag is a part of HTML DOM elements. The anchor property is a read only property that returns a list of anchor tags inside a document. The anchor object is represented as . There are two ways to get the length of the anchors object. One way is to use the anchors.length property that returns the number of anchor tags in a document. The other way is to use getElementByTagName method to access the anchor tag and use the length property. Both ... Read More

Get Title and Full URL of a Document in JavaScript

Lokesh Yadav
Updated on 08-Dec-2022 07:50:08

1K+ Views

In this article we will learn how to get the title and full URL of a document in JavaScript with the help of examples. The Javascript HTML DOM has provided some basic methods to access and manipulate the HTML data. To find the title and URL of a document, JavaScript has provided document.title and document.URL respectively. The document.title property − The document.title property returns the current title of the document. This property applies to HTML, SVG, XUL, and other documents. The syntax to get the title of the document is shown below. document.title The document.url property − The URL ... Read More

Advertisements