Archive for the ‘JavaScript’ Category
JavaScript: Restrict keyboard character input
- May 27th, 2008
- Posted by Stewart
- Permalink
- 0 Comment(s)
If you want to improve your form inputs by restricting the characters the user enters, this function might come in handy. It restricts the keyboard input for a text field so that they can only enter the characters you want. Read more »
Javascript: Swapping select box options
- December 3rd, 2007
- Posted by Stewart
- Permalink
- 0 Comment(s)
Here’s a JavaScript function that let’s you swap options from one select box to another to allow users to choose the options they want. Be careful when using this type of functionalist as it could be inaccessible to some users and can cause problems when submitting your forms. Read more »
Javascript: enabling and disabling form field elements
- August 17th, 2007
- Posted by Stewart
- Permalink
- 5 Comment(s)
![]()
Here’s another useful function for enabling and disabling your form elements using javascript. This function can be used to disable form elements when a user has submitted a form to stop them submitting it again. Read more »
Javascript: check if a UK postcode is valid
- May 12th, 2007
- Posted by Stewart
- Permalink
- 4 Comment(s)
![]()
Here’s two useful postcode functions; one that will help for checking if a string is in the valid format for a UK postcode; and another that formats a string into a nice postcode format. They both use regular expressions to make them fast! You could use them for client-side form validation. Read more »
Javascript: Pop up DHTML calendar using CSS
- March 30th, 2007
- Posted by Stewart
- Permalink
- 3 Comment(s)
If you are looking for a simple JavaScript calendar that uses CSS and is easy to customise, then take a look at my calendar. I have created a basic javascript calendar that can be tweaked to suit your needs that makes it easy for your users to pick a date. Read more »
Javascript: trim leading and trailing spaces
- March 29th, 2007
- Posted by Stewart
- Permalink
- 4 Comment(s)
Here’s a quick function to remove leading, trailing and multiple spaces from a string using regular expression which is much faster that using loops! Read more »
Careful use of accessible JavaScript
- March 7th, 2007
- Posted by Stewart
- Permalink
- 0 Comment(s)
![]()
JavaScript can really pose some difficult accessibility issues for users when not used correctly and with consideration. But there are some steps you can follow in your designs to make sure your site accessible to a larger audience. By designing with these steps in mind means you will not be ignoring the 3-6% of users* who cannot, or will not use JavaScript. Read more »
Javascript: Checking if a date is valid
- February 20th, 2007
- Posted by Stewart
- Permalink
- 0 Comment(s)
Sometimes when creating a web application you need to check that a date entered by the user is actually valid! Here is a quick and easy way of checking the validity of a string to ensure that it’s in the correct format (DD/MM/YYYY) and is a real date by returning true or false. Read more »
Javascript: Select all options for a select box
- February 16th, 2007
- Posted by Stewart
- Permalink
- 3 Comment(s)
Here’s a javascript function that will allow the user to select all or none of the options in a multiple select box. It is quite simple to use, first either provide the id of the select box or the actual select box object and it will do the rest. Read more »
