The isNaN() function (NaN stands for Not a Number) can be useful if you are looking at form inputs or similar and is used to detect if a value is not a number. For example, the following code shows the output of isNaN() on two variables.
How To Use Them
Using the Google Ajax libraries on your own site is quite easy, and you can do it in a number of different ways.
Normally, you would download the latest and greatest version of your chosen library and upload it to your site. Here is an example using the MooTools.
The following example will cause the page to redirect to another page, keeping the browser history. This might seem like a minor point, but if you redirect a user to another page they will be able to click back, which will mean that they are redirected again.
var rows = document.getElementsByTagName("tr");
We can then iterate through these rows, grabbing the column that you want to search on, with the following code.
The other day I was approached by a friend who had this odd looking virus message on their screen. They said that they hadn't been doing anything in particular, just writing an email and surfing the net in Firefox when all of a sudden this pop-up appeared on screen and told them they had a virus.
The following script can be used if you want to simulate a typewriter in an element on screen. I have put in a lot of comments to describe what is happening but the script works by taking each array element in turn and adding it character by character to the content of the selected element.
There is nothing more irritating than when you are typing out a long message in a text box and you accidentally move backwards, or clicking on a link and moving off page, therefore losing data you may have entered. There is a solution to stop this happening and it involves the onbeforeunload event.
Although not technically a fully supported event, onbeforeunload is run just before the page is unloaded out of cache. The onunload event occurs right after this, and it is too late by that point.
To prevent a user from moving out of the current page without some form of warning you will need to return some text with the onbeforeunload event. In some browsers that text will be used as part of the message, some browsers will ignore the message but continue anyway.
Include the following body tag in the page you want to incorporate this feature into.
I have created a handy little bookmarklet that you can use to do the same thing.
This code has been tested in IE7, Firefox and Chrome and works well in all three.