<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html dir="ltr" lang="en"><head><meta http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="content-language" content="en"><meta name="author" content="Ligaya Turmelle"><meta name="generator" content="PhpED 4.5"><meta name="description" content="Javascript test"><meta name="keywords" content="test, Javascript"><meta name="creation-date" content="02/20/2006"><meta name="revisit-after" content="15 days"><title>prompt test</title><link rel="stylesheet" type="text/css" href="my.css"><script language="text/javascript"><!-- function Checkdate() { // check to see if the DOM is supported if(!document.getElementByID() || !document.createTextNode()) { return; } if(!document.getElementById('date')) { return; } // create regex to check date format var pattern = new RegExp("\\d{2}/\\d{2}/\\d{4}"); // get the data from the data field var indate = document.getElementById('date').value; // if indate is empty if(indate == '') { alert ("Please enter a date"); return false; } else { // while the indate does not match the pattern and indate does not = null // An odd logic pattern - but it works. while(!pattern.test(indate) && indate != null) { indate = prompt("Invalid Format.\nPlease use MM/DD/YYYY format", indate); } return indate !=null; } }//--></script></head><body> <h1>Playing</h1> <form action="" accept-charset="utf8" method="post" onsubmit="return Checkdate();"> <p> <label for="date">Please enter a date for an event. (MM/DD/YYYY)</label><br /> <input type="text" name="date" id="name" /> <input type="submit" name="submit" value="Check" /><br /> Example 10/21/2006 </p> </form></body></html>