日期:2014-05-16 浏览次数:20483 次
<html>
<head>
<title>字符串格式检验</title>
<script>
function checkStrFormat(str)
{
if(/^([a-zA-Z_]{1})([\w]*)$/g.test(this.value))
{
alert("just letter is permitted"); // 报警提示语句。
}
}
</script>
</head>
<body>
<form name="timeForm" action="resultOK.html">
<input type="text" onblur="checkStrFormat(this.value)">
</form>
</body>
</html>