allow only alphabets and underscore using javascript
<p>I am allowing a string to contain only alphabets and underscore,but is i enter fist character as alphabet or underscore and later if i put any invalid character then this validation is being done.I have done validation as follows:</p>

<pre><code>function permission_validate()
{var permission=document.permissionForm.permission.value;var allowedStr=/[A-Za-z_]/;

if(!allowedStr.test(permission)){document.getElementById("permission_Er").innerHTML="* Required field can contain Only A-Z/az/_";

document.permissionForm.permission.focus();return false;}else{return true;}
</code></pre>
