javascript 验证姓名

来源:百度知道 编辑:UC知道 时间:2024/07/07 08:15:44
<!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 ch()
{
var x=(document.getElementById("tx").value);
var i=1;
while(i<x.length)
{
(var c=x.slice(0,i);
i++;
if(parseInt(c)<0x4e00||parseInt(c)>0x9fa5)
alert("请输入你的真实姓名");
else
alert("ok");
}}
</script>
</head>

<body>
<form ac

<!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 ch()
{
var x=(document.getElementById("tx").value);
var i=1;
while(i<x.length)
{
var c=x.slice(0,i);
i++;
if(parseInt(c)<0x4e00||parseInt(c)>0x9fa5)
alert("请输入你的真实姓名");
else
alert("ok");
}}
</script>
</head>

<bo