我的两个表单代码:
[code]
  <script type="text/javascript">
  <!--
  function Form_Validator(theForm)
  {
   if(theForm.username){
   if(theForm.username.value==""){
   alert("Please enter your UserName!");
   theForm.username.focus();
   return(false);
   }
   }
   if(theForm.password){
   if(theForm.password.value==""){
   alert("Please enter your Password!!");
   theForm.password.focus();
   return(false);
   }
   }
  }
  //-->
</script> <form name="from1" method="POST" onSubmit="return Form_Validator(this)" >
Name:&nbsp;&nbsp;
<input name="username" type="text" class="input" />
&nbsp;&nbsp;
<input type="image" src="images/login.jpg" align="middle" onclick="form1.action='?action=index.php&action=login';form1.submit();" />
<br/>
Password:&nbsp;&nbsp;
<input name="password" type="password"  class="input"/>
&nbsp;&nbsp;
<img style="cursor:hand;" src="images/reg.jpg" onclick="window.location='index.php?action=reg'">
</from><form name="form" style="margin:0px; padding:0px;" action="?action=search" method="POST" >
Search:<input name="key" class="wenbenkuang" id="key" />
&nbsp;<select name="cid"><option value="0">All Products</option>
</select>&nbsp;&nbsp;
<input type="image" name="submit" src="images/search.gif" align="middle" onclick="form2.action='?action=index.php&action=search';form2.submit();"/>
</form>
[/code]
把搜索放在上面就没事。放在下面。。提交的时候。。就回到form1