Javascript Archive
-
Javascript ‘Are You Sure?’ Message
Posted on 12th Jul 2010 | No CommentsThis small but very handy piece of code… onclick="javascript:return confirm('Are you sure you want to delete this?')" For example: <input type="submit" name="button" value="Delete Page" onclick="javascript:return confirm('Are you sure you want... -
Validating in-valid CSS
Posted on 30th May 2010 | No CommentsEver had it where your stylesheet contains code that doesn’t validate with the W3C standards…. Yet there’s not an easy way round it? For example ‘opacity’….. This code adds an... -
Create getElementsByClassName() function for use in IE
Posted on 2nd May 2010 | No CommentsThe getElementsByClassName() is already present in some modern browsers, but this code from Kevin Yank at Sitepoint just adds it for those browsers that don’t already have it…. function getElementsByClassName(className)... -
JavaScript Dot Operator List
Posted on 2nd May 2010 | No CommentsQuick Reference guide of dot operators: .length // counts the number of items in an array .nodeName // reference the name of the node, i.e. p for p tag, etc.... -
JavaScript Quick Syntax Check
Posted on 2nd May 2010 | No CommentsBasic list of example code you can copy & paste… var myElement = document.getElementById("elementId"); var listItems = document.getElementsByTagName("li"); for (var i = 0, ii = listItems.length; i < ii; i++)... -
Speeding Up ‘For Loops’
Posted on 2nd May 2010 | No CommentsThe typical format for a ‘for loop’ to run through the list items in an array is as follows… var myArray = [1, 2, 3, 5, 8, 13, 21, 34];... -
Create a JavaScript Array
Posted on 2nd May 2010 | No CommentsTo create an array in JavaScript is pretty straight forward, just declare the variable name equal to empty square brackets, like this: var rack = []; To add variables, you... -
JavaScript Accepted Variable Names
Posted on 2nd May 2010 | No CommentsIn the words of Sitepoints Kevin Yank…. Your variable names can comprise almost any combination of letters and numbers, though no spaces are allowed. Most punctuation and symbols have special... -
Javascript & New Lines
Posted on 2nd May 2010 | No CommentsOne thing you need to be careful of, and has caught me out a few times when jumping from PHP to Javascript, is ‘new lines’…. In JavaScript a new line...






![Speeding Up ‘For Loops’ The typical format for a ‘for loop’ to run through the list items in an array is as follows… var myArray = [1, 2, 3, 5, 8, 13, 21, 34];...](http://www.jonmoore.co.uk/wp-content/uploads/2010/05/Bridge-115x115.jpg)
![Create a JavaScript Array To create an array in JavaScript is pretty straight forward, just declare the variable name equal to empty square brackets, like this: var rack = []; To add variables, you...](http://www.jonmoore.co.uk/wp-content/uploads/2010/05/IP_Necklace_001-115x115.jpg)

