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 AmitDiwan
Page 241 of 840
HTML DOM timeStamp Event Property
The HTML DOM timeStamp property returns the elapsed time in milliseconds since the document was loaded when an event was created or triggered. This property is particularly useful for measuring performance, timing user interactions, and creating time-based game mechanics. The timeStamp property only works if the event system supports it for the particular event type. Most modern browsers support this property for common events like mouse events, keyboard events, and touch events. Syntax Following is the syntax for accessing the timeStamp property − event.timeStamp This returns a number representing the time in milliseconds ...
Read MoreHTML DOM Location host Property
The HTML DOM Location host property returns or sets the hostname and port number of the current URL. This property combines both the hostname (like www.example.com) and port number (like 8080) in the format hostname:port. If no port is specified in the URL, only the hostname is returned. Syntax Following is the syntax for getting the host property − location.host Following is the syntax for setting the host property − location.host = "hostname:port" Return Value The location.host property returns a string containing the hostname and port number. If the ...
Read MoreHTML DOM Location hostname Property
The Location hostname property is part of the HTML DOM Location object that allows you to get or set the hostname portion of the current URL. The hostname is the domain name part of a URL, excluding the protocol, port number, and path. Syntax Following is the syntax to get the hostname property − location.hostname Following is the syntax to set the hostname property − location.hostname = hostname Return Value The hostname property returns a string representing the domain name of the URL. For example, if the URL is ...
Read MoreHTML DOM Location href Property
The HTML DOM Location href property returns or sets the complete URL of the current page. This property provides access to the entire URL including protocol, hostname, port, path, search parameters, and fragment identifier. Syntax Following is the syntax for getting the href property − location.href Following is the syntax for setting the href property − location.href = "URL" Parameters The location.href property accepts the following parameter when setting a value − URL − A string representing the complete URL to navigate to. This can be an ...
Read MoreHTML DOM Input Password pattern property
The HTML DOM Input Password pattern property is used for setting or returning the pattern attribute of an input password field. It validates the password against a regular expression specified by the pattern property to ensure the input meets specific format requirements. Syntax Following is the syntax for setting the pattern property − passwordObject.pattern = regexp Following is the syntax for returning the pattern property − passwordObject.pattern Parameters regexp − A string containing a regular expression that the password input value must match. If the input doesn't match the ...
Read MoreHTML reserved Attribute
The HTML reversed attribute defines that the list order in ol HTML element should be descending in an HTML document. When this attribute is present, the ordered list numbers count down from a higher number to a lower number instead of the default ascending order. Syntax Following is the syntax for the reversed attribute − Item 1 Item 2 Item 3 The reversed attribute is a boolean attribute, meaning its presence indicates the list should be reversed. No value is needed. How the Reversed Attribute ...
Read MoreDifference Between Cache and Cookies
In web development, cache and cookies are both client-side storage mechanisms, but they serve different purposes. Cache stores website content to improve loading speed, while cookies store user-specific data to maintain sessions and preferences across visits. What is Cache? Cache is a temporary storage location where web browsers store copies of web resources like HTML pages, images, CSS files, and JavaScript. When you revisit a website, the browser can load these cached resources locally instead of downloading them again from the server, resulting in faster page loading times. Cache Characteristics Stores frequently accessed website content ...
Read MoreHTML DOM Location port Property
The HTML DOM Location port property returns or sets the port number of the current URL. If no port is explicitly specified in the URL, it returns an empty string. Common default ports (80 for HTTP, 443 for HTTPS) are typically not displayed unless explicitly set. Syntax Following is the syntax to get the port number − location.port Following is the syntax to set the port number − location.port = portNumber Return Value The location.port property returns a string representing the port number. If no port is specified, it ...
Read MoreHTML DOM Location reload() method
The HTML DOM Location reload() method is used to reload the current document, providing the same functionality as the browser's reload button. This method re-renders the entire page, either from the server or browser cache depending on the parameter passed. Syntax Following is the syntax for the location.reload() method − location.reload(forceGetParameter) Parameters The forceGetParameter is an optional boolean parameter that determines how the page is reloaded − forceGetParameter Details true Forces the page to reload from the server, bypassing the browser cache. false ...
Read MoreHow to Only Allow Numbers in a Text Box using jQuery?
We can easily allow only numbers in a textbox using jQuery. This is useful for form validation and ensures users can only enter numeric values in specific input fields. We will explore two different approaches to achieve this functionality. Allow Only Numbers in a TextBox using jQuery replace() method Allow Only Numbers in a TextBox using jQuery fromCharCode() method Method 1: Using jQuery replace() with keyup Event This method uses the keyup event to filter out non-numeric characters after they are typed. It uses a regular expression with the replace() method to remove any character ...
Read More