<input type="text" id="itext" >
<input type="button" value="ok" onclick="pr()">
<script type="text/javascript">
function pr()
{
var iif = /^[a-zA-Z0-6]{6,20}$/;
if(document.getElementById('itext').value.search(iif) == 0)
alert('true');
else
alert(false);
}
</script>