html表单提交的方式

来源:互联网 发布:电话呼叫中心软件 编辑:程序博客网 时间:2024/05/16 10:04
  1. 方式一:通过submit按钮提交
<!DOCTYPE html><html><head>    <title>通过submit按钮提交</title>    <meta charset="UTF-8"/></head><body>    <form action="" method="get" id="form1">        <input type="text" name="username"></input>        <input type="submit" value="提交" />    </form></body></html>
  1. 方式二:通过一般按钮button提交
<!DOCTYPE html><html><head>    <title>通过一般按钮提交</title>    <meta charset="UTF-8"/></head><body>    <form action="" method="get" id="form1">        <input type="text" name="username"></input>        <input type="button" value="ok" name="sb" onclick="submit1();">    </form>    <script type="text/javascript">        function submit1()        {            var form1 = document.getElementById("form1");            form1.action = "day05_01test.html";            form1.submit();        }    </script></body></html>
  1. 方式三:通过超链接提交
<!DOCTYPE html><html><head>    <title>通过超链接提交</title>    <meta charset="UTF-8"/></head><body>    <a href="day05_01test.html?username=张三">通过超链接提交</a> </body></html>
0 0
原创粉丝点击