码迷,mamicode.com
首页 > 其他好文 > 详细

一个表单两个提交按钮的实现

时间:2014-05-18 00:46:03      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:blog   class   c   java   ext   http   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>一个form两个提交按钮,分别提交到两页面</title>
<script type="text/javascript">  
    function save()
     {   
         document.form1.action="a.asp";
         document.form1.submit();
     }
    
    function send()
     {
         document.form1.action="b.asp";
         document.form1.submit();
     }   
</script>
</head>
<body>
<form name="form1" method="post"> <!--method 必须写-->
  <input type="text" name="username" value="scott">
  <input type="button" value="发送" onclick="send();">
  <input type="button" value="保存" onclick="save();">
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>一个form两个提交按钮,分别提交到两页面</title>
<script type="text/javascript">  
    function send()
     {
        if (i==1)
         {document.form1.action="b.asp";}
        else
         {document.form1.action="a.asp";}
         document.form1.submit();
     }   
</script>
</head>
<body>
<form name="form1">
  <input type="text" name="username" value="scott">
  <input type="button" value="发送" onclick="send(0);">
  <input type="button" value="保存" onclick="send(1);">
</form>
</body>
</html>

  

一个表单两个提交按钮的实现,布布扣,bubuko.com

一个表单两个提交按钮的实现

标签:blog   class   c   java   ext   http   

原文地址:http://www.cnblogs.com/aljxy/p/3734286.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!