Tbodies and Rows
Wednesday August 31, 2011
The only difference between referencing rows in the thead or tfoot of a table and referencing them in a tbody is that a table can have more than one tbody. ... Read More
Table Footer
Tuesday August 30, 2011
The footer of a table is as easy toreference in JavaScript as the table heading is. We could insert a row the same way as we did with the head ... Read More
Table Heading
Monday August 29, 2011
Adding a heading row to a table is as simple as
Table Heading
Table Caption
Sunday August 28, 2011
The DOM call to update a table caption is very straightforward as you can access it directly once you reference the table rather than having to hunt within the table ... Read More
Switch Fallthrough
Saturday August 27, 2011
In a JavaScript switch statement when a particular case is run it processes all of the code through to the next break statement. This means that the code may fall ... Read More
Optional Function Arguments
Friday August 26, 2011
JavaScript functions can accept a variable number of arguments. JavaScript provides a completely different way of making function arguments optional from the way that most programming languages do it. JavaScript's ... Read More
Unnecessary Wrappers
Thursday August 25, 2011
Some JavaScript statements are unnecessary and confusing. Why would you want to write var num = new Number(6); when writing var num = 6; is not only shorter but also ... Read More
Restrictions With innerHTML
Wednesday August 24, 2011
Continuing with our "JavaScript By Example" looking at the Document Object Model we get to to the first of a series dealing specifically with how you can interact with tabular ... Read More
Simplifying Creates
Tuesday August 23, 2011
Having looked at all the different add, replace, delete etc commands for updating the Document Object Model, it is obvious that actually creating new nodes for our web page is ... Read More
Replace A Node
Monday August 22, 2011
Updating the web page by deleting an old node and adding a new node or adding a new node and then deleting the old one doesn't lead to the best ... Read More
Add Before The Current Node
Sunday August 21, 2011
As well as the ability to add a node as the last child node within a specified node, the JavaScript DOM also provides us with a way to add a ... Read More
Ignore Case Sort
Saturday August 20, 2011
The upper and lower case characters have their own separate place in the ASCII sequence that JavaScript defaults to using when you sort an array. We can tell the sort ... Read More
Date Array Sort
Friday August 19, 2011
JavaScript is flexible in the ways that you can sort arrays. Sorting an array of dates in yyyy/mm/dd order is simple. That doesn't mean that sorting an array of dates ... Read More
Numeric Array Sort
Thursday August 18, 2011
The array sort method normally sorts JavaScript arrays in dictionary order. If your array contains numbers then you will want to override the way the sort compares two values so ... Read More
Add A Child Node
Wednesday August 17, 2011
The same appendChild method we have previously used to join two nodes together outside of the web page can also be used to attach a node into the web page. ... Read More
Create A Document Fragment
Tuesday August 16, 2011
Attaching nodes together using appendChild requires that we are inserting one node as a child of the other. This means that we can't use it if we want to have ... Read More
Combining Nodes
Monday August 15, 2011
In the 19th DOM "JavaScript By Example" we look at how to combine two nodes that we have created together before we add them to the web page. By attaching ... Read More
JavaScript Form Processing - A Complete Example
Sunday August 14, 2011
To finish off the series of tutorials on modern unobtrusive form field validation, I have put together all of the HTML and JavaScript code mentioned in the various examples so ... Read More
Modern Combo Box
Saturday August 13, 2011
One of the new form field types that is proposed to be added in HTML 5 is the combo box. We don't need to wait until then to use combo ... Read More
Shuffle
Friday August 12, 2011
JavaScript can implement PHP like functionality. One thing that PHP makes really easy to do is to shuffle the content of an array into a random order. This is extremely ... Read More
Unobtrusive Random Images
Thursday August 11, 2011
One of the first things most old books on JavaScript used to teach was selecting a random image to display in a set spot in your web page. Such scripts ... Read More
Create A Text Node
Wednesday August 10, 2011
Adding text into the DOM isn't quite as straightforward as you might expect. Everything in the DOM is a node and so before we can add text to the DOM ... Read More
Create An Element
Tuesday August 9, 2011
The opposite of removing a tag from your web page is to add one. Before we can add a tag though we first need to create it. In this 17th ... Read More
Remove A Node
Monday August 8, 2011
In this 16th of the DOM "JavaScript By Example", we look at the easiest of the updates that you can do to the HTML itself - to actually remove a ... Read More
Pattern Matching
Sunday August 7, 2011
Continuing on with writing unobtrusive code to do our form validations we come to the new "pattern" attribute that HTML5 adds to the input tag. Here we will consider the ... Read More
Concentration/Memory Game
Saturday August 6, 2011
Today's JavaScript game tests your visitors memory. In the card game upon which this script is based two cards are flipped over looking for matching pairs. If the two cards ... Read More
Cryptograms
Friday August 5, 2011
Shake the cobwebs off of those code breaking skills you learned back at school and see if you can work out the substitution cipher my JavaScript generated cryptogram uses. Once ... Read More
Hangman
Thursday August 4, 2011
Add a fun game to your page or learn more about how JavaScript string objects work. Do you remember playing this simple game when you were younger? Well now thanks ... Read More
innerHTML
Wednesday August 3, 2011
While not necessarily the best way to update the content of your web page (since it doesn't update the DOM and so makes it more difficult to apply further updates) ... Read More
Set Styles
Tuesday August 2, 2011
You can easily change the way that your web page looks by using JavaScript to dynamically change the styles that are applied to the various parts of your web page. ... Read More
Preloading Images
Monday August 1, 2011
Where we have a JavaScript that will be changing the images displayed in the web page we ought to pre-load those images before they are needed in order that the ... Read More
