Chapter 8: Forms and Regular Expressions

Return to Chapter 8


To use this script on your own page, click in the text area below, select all, and copy to grab the script. Then, just paste into your own page — and you're done.

Validating a File Name

See it run: Validating a File Name

Script 8.3

This JavaScript asks for an image location and, if it passes the validation, displays the image on the page.