I'm not good with Javascript, so please help me.

I have a page generate by ASP and I want to validate the form value.
Generated page by ASP :

<form method=post action="<%=strPrgName%>" name="OrderForm">
<% for i = 1 to itemcount %>
Name : <input name=toname<%=i%> onBlur="validateName(this)">
<% next %>
<input type=submit value="View">

For example itemcount = 2, html code will be like this :
<form method=post action="<%=strPrgName%>" name="OrderForm">
Name : <input name=toname1 onBlur="validateName(this)">
Name : <input name=toname2 onBlur="validateName(this)">
<input type=submit value="View">

Javascript :
<script language="JavaScript">
function validateName(field)
var val = field.value;
alert("Format name wrong !");

I got this script and modify it, the original code for validating number only. My need is this script validate the form to check if input only alphanumeric (a-z, A-Z, "," and ".").

How to do it ? Thanks.