Web Development Articles - Page 526 of 1049

JavaScript Cursor property

AmitDiwan
Updated on 08-May-2020 11:05:17

203 Views

The cursor property is sets or returns the cursor type that will be displayed for the cursor property.Following is the code for implementing JavaScript Cursor property −Example Live Demo    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    } JavaScript Cursor property Hover the mouse over the above paragraph after clicking the below button Change Cursor    let sampleEle = document.querySelector(".sample");    document.querySelector(".Btn").addEventListener("click", () => {       sampleEle.style.cursor = "crosshair"; }); OutputOn clicking the “Change Cursor” button −

JavaScript Array.isArray() method

AmitDiwan
Updated on 08-May-2020 10:41:18

154 Views

The JavaScript Array.isArray() method is used to check if an object is an array or not.Following is the code for the Array.isArray() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 20px;       font-weight: 500;    } JavaScript Array isArray() CLICK HERE Click on the above button to check if the above object is an array or not    let fillEle = document.querySelector(".sample");    let arr = ["cow", "bull", ... Read More

JavaScript array.includes() method

AmitDiwan
Updated on 08-May-2020 10:37:45

148 Views

The JavaScript array.includes() method is used to check if an array contains a given element or not.Following is the code for the array.includes() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 20px;       font-weight: 500;    } JavaScript Array includes() CLICK HERE Click on the above button to check if the array contains lion element or not    let fillEle = document.querySelector(".sample");    let arr = ["cow", "bull", "lion", "tiger", "sheep"];    fillEle.innerHTML = arr;    document.querySelector(".Btn").addEventListener("click", () => {       fillEle.innerHTML = "Lion is present in array: " + arr.includes("lion");    }); OutputOn clicking the “CLICK HERE” button −

JavaScript focus

AmitDiwan
Updated on 07-May-2020 15:04:05

530 Views

The JavaScript focus() method is used for focusing on an element only if the element can be focused.Following is the code for the JavaScript Focus() Method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JavaScript focus() CLICK HERE Click on the above buttons to focus the input field    let sampleEle = document.querySelector(".sample");    document.querySelector(".Btn").addEventListener("click", () => {       sampleEle.focus();    }); OutputOn clicking the “CLICK HERE” button −

JavaScript exec() Method

AmitDiwan
Updated on 07-May-2020 15:00:01

223 Views

The exec() method executes the search for match and if the matched text is found in the specified string then it is returned otherwise null is returned.Following is the code for the JavaScript exec() Method −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JavaScript exec() Lorem ipsum dolor, sit amet consectetur adipisicing. CLICK HERE Click on the above buttons to execute regex   ... Read More

JavaScript escape()

AmitDiwan
Updated on 07-May-2020 14:51:01

728 Views

The escape() function in JavaScript is used for encoding a string. It is deprecated in JavaScript 1.5.Following is the code for the JavaScript escape()Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JavaScript escape() CLICK HERE Click on the above buttons to encode the URI    let sampleEle = document.querySelector(".sample");    let url = "https://www.google.com/images?size=420px&name=8s1f.jpg";    document.querySelector(".Btn").addEventListener("click", () => {       sampleEle.innerHTML = escape(url);    }); OutputOn clicking the “CLICK HERE” button −

JavaScript Error name Property

AmitDiwan
Updated on 07-May-2020 14:48:00

182 Views

The error name property is used for setting or getting the name of the error.Following is the code for the Error name property −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JavaScript Error name Property CLICK HERE Click on the above buttons to see the error name    let sampleEle = document.querySelector(".sample");    document.querySelector(".Btn").addEventListener("click", () => {       try {          confrm("Are you sure");       } catch (e) {          sampleEle.innerHTML = "Error: " + e.name;       }    }); OutputOn clicking the “CLICK HERE” button −

JavaScript Error message Property

AmitDiwan
Updated on 07-May-2020 14:43:52

237 Views

The error message property sets or returns an error message in JavaScript. Following is the code for the error message property −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JavaScript Error message Property CLICK HERE Click on the above buttons to see the error message    let sampleEle = document.querySelector(".sample");    document.querySelector(".Btn").addEventListener("click", () => {       try {          confrm('Are you sure');       } catch (e) {          sampleEle.innerHTML = "Error: " + e.message;       }    }); OutputOn clicking the “CLICK HERE” button −

JavaScript encodeURI(), decodeURI() and its components functions

AmitDiwan
Updated on 07-May-2020 14:37:11

299 Views

The encodeURI() function encodes the complete URI including special characters except except (, / ? : @ & = + $ #) characters.The encodeURIComponent() function encodes some parts of the URI by basically encoding the special characters. It also encodes the following characters − (, / ? : @ & = + $ # )The decodeURI() function decodes the URI generated by the encodeURI() function.The decodeURIComponent() function is used to decode some parts of URI generated by encodeURIComponent().Following is the code for the encodeURI(), decodeURI() and its component functions −Example Live Demo Document    body { ... Read More

JavaScript - Creating a Custom Image Slider

Disha Verma
Updated on 24-Apr-2025 16:44:12

971 Views

An image slider is a user interface component in JavaScript that allows users to view a series of images in a slideshow format. It is also known as a carousel or slideshow. An image slider consists of navigation buttons (such as next and previous buttons) that allow users to navigate from one image to the other. With the help of basic HTML for structuring and CSS for designing or making the image slider presentable, along with simple JavaScript logic, you can create an image slider efficiently. This article will guide you through creating a basic image slider with navigation buttons. ... Read More

Advertisements