The JavaScript replace() function does not replace all instances of the query string - only the
first one encountered. This function replaces all instances of the unwanted string.
[Read More]
There are number of ways you can trim strings using javascript. The best way is to prototype
the string object, adding a trim method, so you can perform the action by merely calling
“string.trim()”.
[Read More]
Error trapping with JavaScript only works for newer generation browsers. However, older browser generally
ignore window.onerror code, so it is worth putting in. There are two ways to do this:
[Read More]
Regular expressions are objects in JavaScript. For example, if you have an input field that should only
allow characters a-z (lower and upper case) and numerical digits, you could use regular expressions to
do the input validation as follows:
[Read More]
The onbeforeunload event handler (supported by Internet Explorer 4+ only) can be used to confirm that the user does want to close the browser window or navigate away from the current page. If your event handler returns something, this message will be included in a confirmation which the user must...
[Read More]