着急,关于检测输入内容的
如何控制输入只能是英文字母(大小写)、中文、数字、下划线(_)
前面几位朋友帮忙解决了一部分,还差允许输入中文,请大家帮忙,谢谢。
代码如下:
==========================================================
<script>
function clientform_Validator(theForm)
{
//if (theForm.UID.value == "" || 检测字符串)
if ((theForm.UID.value == "" )|| (!(/^\w+$/g.test(theForm.UID.value))))
{
alert("用户名不能为空或者包含不允许的字符!");
theForm.UID.focus();
return (false);
}
}
</script>
<form name="register" method="post" action="" onSubmit="return clientform_Validator(this)">
<input name="UID" type="text" class="pn-text" id="UID5">
<input name="submit" type=submit>
</form>
==========================================================
前面的贴子:
http://expert.csdn.net/Expert/topic/1885/1885396.xml?temp=.8658258