You might find this example useful:
HTML Code:
<script type="text/javascript">
window.onload=function()
{
document.getElementById('go').onclick=function()
{
var dom='http://mysite.com/', // Set your web domain
inp=document.getElementById('inp'); // ID of textbox that accepts the zip code
if(inp.value.match(/(\d)/))
location.href=dom+inp.value+'.htm'; // If matches the regex, goes to domain plus [zip].htm
else{ // Else informs the user that should be numbers.
alert('Numbers please');
inp.value='';inp.focus();}}}
</script>
<label>Your Zip code:</label>
<input type="text" id="inp"><input type="button" value="Go" id="go">
Bookmarks