zoukankan      html  css  js  c++  java
  • (转)一个form表单实现提交多个action

    方法一:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    
    <body>
    
    <form action="" name="form1">
        <input type="button" value="查询1" type="submit" onclick="form1.action='action_1';form1.submit();"/>
        <input type="button" value="查询2" type="submit" onclick="form1.action='action_2';form1.submit();" />
    </form>
    
    或:
    <Script Language="JavaScript">
        function modify()
        {
        document.form1.action="modify.jsp";
        document.form1.submit();
        } 
    
        function delete()
        {
        document.form1.action="delete.jsp";
        document.form1.submit();
        }
    </Script>
    
    <form name="form1" action="">
        <INPUT Type="Button" Name="Modify" Value="修改" onClick="modify()">
        <INPUT Type="Button" Name="Delete" Value="删除" onClick="delete()">
    </form>
    这样可以实现将多个按钮发送到不同的网页中。
    </body>
    </html>
    
    方法二:
    提交form的时候,里面的action不能带参数,例:
    <form action="test.do?args=888"> 
       <input type="button" value="submit">
    </form>
    
    通过这个方法,test.do无法读取args,必须换成以下写法
    <form action="test.do"> 
       <input type="hidden" name="args" value="888">
       <input type="button" value="submit">
    </form>
  • 相关阅读:
    前端知识体系
    DOMContentLoaded与load的区别
    最佳网页宽度及其实现
    一些颜色工具网站
    Firebug入门指南
    CSS中背景图片定位方法
    字符编码笔记:ASCII,Unicode 和 UTF-8
    学JS的书籍
    深入理解定位父级offsetParent及偏移大小
    event——事件对象详解
  • 原文地址:https://www.cnblogs.com/liuswi/p/3473379.html
Copyright © 2011-2022 走看看