God Speaks - JavaScript Version

Posted on June 7, 2007

{{LEARN JAVASCRIPT HERE}}

JavaScript version of the God Speaks billboard script.

This is a script that I wrote to display the quotes that surfaced on billboards across the country. These billboards contained quotes from God and the source of the billboards is still a mystery.

View the script in action

Download the script here (< 2kb) Current Download Count: 2010

Validate/Format Phone Numbers

Posted on October 16, 2006

{{LEARN JAVASCRIPT HERE}}

The purpose of this script is to format and validate Telephone Numbers in a form field. The script strips all non-numeric characters and then validates that the remaining characters are sufficient to make up a valid phone number. If there remaining string is 10 characters in length, the script then formats by adding a “-” after the third and sixth digits. Resulting in a mask like ###-###-####.

The example script does the validation/formatting onBlur, meaning when the cursor leaves the Phone Number field. You can also set the event to happen onSubmit or onClick of the Submit button, etc.

View the script in action

Download the script here (< 2kb)   Current Download Count: 5434

Rate This script
Hot Scripts

 

Validate/Format Social Security Number

Posted on October 16, 2006

{{LEARN JAVASCRIPT HERE}}

The purpose of this script is to format and validate Social Security Numbers in a form field. The script strips all non-numeric characters and then validates that the remaining characters are sufficient to make up a valid SSN. If there remaining string is 9 characters in length, the script then formats by adding a “-” after the third and fifth digits. Resulting in a mask like ###-##-####.

The example script does the validation/formatting onBlur, meaning when the cursor leaves the SSN field. You can also set the event to happen onSubmit or onClick of the Submit button, etc.

View the script in action

Download the script here (< 2kb)    Current Download Count: 4372

Rate This script
Hot Scripts

 

Filed Under JavaScript | 1 Comment

Automatically Put the Cursor in a Form Field

Posted on October 2, 2006

{{LEARN JAVASCRIPT HERE}}

Setting the focus, or for beginners, automatically placing the cursor in one of the fields of your HTML form, is fairly simple. There are two common methods. The first and most common is to use the <BODY> tag’s onload event.

Ex.
<body onload="document.FORMNAME.FIELDNAME.focus();">

However, there are times that you cannot use the body tag and you need another solution. As an alternative to the onLoad event, you can use the setTimeout fuction in JavaScript to wait half a second and then set the focus.

Ex.
<script>
setTimeout(’document.FORMNAME.FIELDNAME.focus()’,500);
</script>

In both cases, you would replace FORMNAME with the value of the name attribute in the <form> tag. You replace FIELDNAME with the value of the name attribute in the <input> tag of the targeted field.

 

Email Spider Stumper “StumpIt” Ver 3.1

Posted on September 19, 2005

{{LEARN JAVASCRIPT HERE}}

This email spider stumper script is based on earlier versions and is the product of all of the great suggestions I have received.

If you are not familiar with this script, its purpose is to stump the email address spider/harvester by changing how your email address is displayed on the page. Version 1 provided basic email address encoding. Version 2 added the functionality of multiple email addresses on one page. Version 3 adds two new features. The first is the ability to pass the link text, for example “Contact Us” rather than just having your email address as the link text. This adds another level of security, as your email address itself is not on the page. The second new feature is the ability to pass extra information such as appending “?subject=hello”. Enjoy!

Version Update

Please note that I have incremented the version number to 3.1. Version 3.0 has a bug which only effects certain complex configurations. If you have installed 3.0, please update to 3.1 by replacing the stumper.js file with the new version (after you configure your domain name in the script).

View this script in action here

Download the Spider Stumper script here (2.21kb)    Current Download Count: 3721

Rate This script
Hot Scripts

JavaScript: Random Quote Generator

Posted on May 18, 2005

{{LEARN JAVASCRIPT HERE}}

I know, I know, it is not PHP and why would I do something in JavaScript that I can do in PHP. I had a need to display a random banner on an HTML page that could not parse PHP. Here is what I wrote.

View the script in action here

First of all, in an effort to keep your web page code clean of a bunch of javascript I suggest calling the script from a file. To do so, place the following call in the location on your page that you wish the random text to appear.

<script language="javascript" src="quotes.js"></script>

Download the JS Random Quote script here (2kb)    Current Download Count: 2991

Rate This script
Hot Scripts

Questions: Email Me

Filed Under JavaScript | 11 Comments