---
title: "同一个表单根据要求递交到不同页面的两种方法"
author: "ttf177"
date: "2010-10-15T10:52:03Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2010-10-15T10:52:03Z"
id: 785554
url: "https://ttf177.iteye.com/blog/785554"
---

方法一：(推荐)  
&lt;form method="POST" name="form1"&gt;  
......  
&lt;input type="button" value="del" name="B1" onclick="document.form1.action='del.asp'; document.form1.submit()" &gt;  
&lt;input type="button" value="view" name="B2"onclick="document.form1.action='view.asp';document.form1.submit()"&gt;  
&lt;input type="button" value="addnew" name="B3" onclick="document.form1.action='addnew.asp'; document.form1.submit()"&gt;  
&lt;/form&gt;  
\------------------------------------------------------------  
方法二  
  &lt;Script Language="JavaScript"&gt;  
    function modify()  
    {  
    document.form1.action="modify.jsp";  
    document.form1.submit();  
    }  
      
    function delete()  
    {  
    document.form1.action="delete.jsp";  
    document.form1.submit();  
    }  
    &lt;/Script&gt;  
      
    &lt;form name="form1" action=""&gt;  
    &lt;INPUT Type="Button" Name="Modify" Value="修 改 " onClick="modify()"&gt;  
     &lt;INPUT Type="Button" Name="Delete" Value="删 除 " onClick="delete()"&gt;  
    &lt;/form&gt;  
    这样可以实现将多个按钮发送到不同网页中。