'JavaScript Code' Category


October 6th, 2006

Detect resolution and resize contents to fit!

It can be a pain to deliver one unified interface or data table that works well on all resolutions. Either it looks tiny on large resolutions, or people with lower resolutions are forced to scroll. Neither or thse are great for usability.
So here is some JavaScript and PHP code that can detect the resolution [...]

September 13th, 2006

Easily create recurring PayPal subscription URLs

Well, I've recently had to create some URLs for people to send me recurring PayPal payments. I find that if you have to modify it at all for a different subscription it can be a pain, gettting lost in the URL encoded string and PayPal parameters. So I whipped up this little JavaScript form to [...]

September 12th, 2006

Count the number of words with JavaScript

Sometimes you need a quick way to count the number of words in a string. Suppose you've typed out a blog post or essay and you want to ensure the minimum word count. Well, you could past into Word or OpenOffice, but this is much quicker! This handy little code snippet provides a textarea and [...]

September 11th, 2006

Count the Number of Characters with JavaScript

Sometimes you need a quick way to count the number of characters in a string. Suppose you're limiting a textarea to 1000 characters, you'll want to show the user how much more they can type. Or, perhaps a forum limits your signature length, and you want a quick way to validate it (including BB Code [...]

August 30th, 2006

How to make a link open in a new window with XHTML

The old-fashioned method of opening a link in a new window is to use the attribute target="_blank". Unfortunately, if you use an XHTML validator, you'll find that this attribute has been deprecated. Originally it was proposed to use the 'rel' attribute, like this: rel="external". Although this validates, it doesn't cause the browser to open a [...]

« Previous PageNext Page »