SSHH网络工作室

一个form中多个Submit

<script language="javascript">
function chkForm(frm)
{
 if (frm.q.value=="" || frm.q.value==" -- 关键词搜索 -- ")
 {
    alert("请输入您要查询的关键字!");
    frm.q.focus();
    return false;
 }
}
function clearInput(thisInput)
{
 if (thisInput.value==' -- 关键词搜索 -- ')
 {
    thisInput.value='';        
 }
}
function doSubmit(i)  
{  
 switch (i)  
    {  
    case 1:  
        searchForm.action="aa.asp";//(此处自己改)  
         break;  
    case 2:  
        searchForm.action="bb.asp";//(此处自己改)  
  break;
    }  
 searchForm.submit();
 
}  
</script>
<table border="0" cellspacing="0" cellpadding="0">

<form action="" method="post" onSubmit="return chkForm(this)" name="searchForm">
    <tr>
      <td height="95"><table width="150" border="0" align="center" cellpadding="0" cellspacing="0">

          <tr>
            <td height="28" colspan="2" align="center">
   <input type="text" name="q" value=" -- 关键词搜索 -- " onFocus="clearInput(this)" style="width:138px"/></td>
          </tr>
          <tr>
<td height="30" align="center"><input type="button" onClick="javascript:doSubmit(1)" value="提交1"/></td>
<td height="30" align="center"><input type="button" onClick="javascript:doSubmit(2)" value="提交2"/></td>
          </tr>
        </table></td>
    </tr>
</form>
</table>

posted on 2008-11-27 11:10  山虎  阅读(501)  评论(0编辑  收藏  举报

导航