<script>
function check(){
if ((team.conf.value.toUpperCase() != "E")&&(team.conf.value.toUpperCase() != "W")) 
{
alert("请输入正确的区域(E)或(W)!");
team.conf.value = "";
team.conf.focus();
return;
}
}
</script>
<form name=team onsubmit="return check()">
<input name=conf><input type=submit>

解决方案 »

  1.   

    <script language="JavaScript">
    <!--
    function mm()
    {
        var e = document.team.conf;
        if (e.value == "") return;
        if (/[^eEwW]/g.test(e.value))
        {
            alert("请输入正确的区域(E)或(W)!");
            team.conf.value = "";
            team.conf.focus();
            return;
        }
    }
    //-->
    </script><form name=team>
    <input name=conf onblur="mm()">
    </form>