web analytics

Category: Javascript

Traversing DOM using JavaScript 1

Traversing DOM using JavaScript

Reading Time: 2 minutesThe HTML DOM defines a standard way for accessing and manipulating HTML documents. The DOM presents an HTML document as a tree-structure expressed as an XML document. DOM is a language independent API, as...

RGB-to-Hex Conversion 0

RGB-to-Hex Conversion

Reading Time: 1 minuteQuestion is: How do I convert RGB values of a color to a hexadecimal string? The algorithm is as follows: make sure that RGB values are in the range 0…255, convert RGB values to...

charachter validation and count for a textbox – Javascript 0

charachter validation and count for a textbox – Javascript

Reading Time: 1 minuteHere I have provided a solution to put a counter for a textbox, that can be updated as each character typed into the textbox. This script will also validate the maximum character length allowed...

Enable/Disable DIV tags through Javascript 0

Enable/Disable DIV tags through Javascript

Reading Time: 1 minuteCopy/Paste following javascript code snippet. <script type="text/javascript"> function toggleAlert() { toggleDisabled(document.getElementById("content")); } function toggleDisabled(el) { try { el.disabled = el.disabled ? false : true; } catch(E){ } if (el.childNodes && el.childNodes.length > 0) {...