<script>
<!--
function showname(form)
{

if(document[form].name.value=='')
{
alert("「请填写表单」不得为空白!");
document[form].name.focus();
return false;
}
else
{
document[form].action = "test.asp";
document[form].submit();
}
}
-->
</script>
<Form method="post" name="sn">
<input type="text" name="name" size="20">
<input type="button" name="b2" value="提交" onclick="javascript:showname('sn');">
</form>