JavaScript Trim Method

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]
Tags: javascript

JavaScript Error Handling

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]
Tags: javascript

JavaScript Regular Expressions

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]
Tags: javascript

Preventing page unload with JavaScript

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]
Tags: javascript