<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>判断是否全角</title>
<script language="javascript">
function check(str){
if(/[\x00-\xFF]/.test(str)){
alert("半角字符")
}
else{
alert("全角字符")
}
}
</script>
</head>
<body>
<input type="text" id="txt">
<input type="button" οnclick="check(txt.value)" value="check">
</body>
</html>
半角: /^[a-zA-Z0-9_\.\-\?]{0,}+$/
全角: /^[^x00-xff]+$/
相关资源:JS验证全角与半角及相互转化的介绍