可以啊!<head>
<script>
function test(){
form1.submit();
alert(form1.a1.value);
}
</script>
</head>
<body>
<form name=form1 onSubmit="test()">
<input type=text value="" name=a1>
<input type=submit value="提交">
</form>
</body>
<script>
function test(){
form1.submit();
alert(form1.a1.value);
}
</script>
</head>
<body>
<form name=form1 onSubmit="test()">
<input type=text value="" name=a1>
<input type=submit value="提交">
</form>
</body>
function test(){
if(form1.a1.value.indexOf("'")!=-1)
{
alert("有单引号,不能提交");
return false;
}
return true;
}
</script>
</head>
<body>
<form name=form1 onSubmit="return test()">
<input type=text value="" name=a1>
<input type=submit value="提交">
</form>
</body>