admin 管理员组文章数量: 1184232
form表单提交三种方式,demo实例详解
第一种:使用type=submit 可以直接提交
<html><head><title>submit直接提交</title></head><body><!-- 表单的提交方式一 --><form method="get">username: <input type="text" name="username"/><br/>password: <input type="password" name="password"/><br/><input type="submit" value="提交"/></form></body>
<script type="text/javascript"></script>
</html>
第二种:使用type=button提交 需要得到表单的控件 使用表单空间调用自己的submit()方法
<pre name="code" class="html"><html><head><title>button提交</title></head><body><!-- 表单的提交方式二 --><form id="form01" method="get">username: <input type="text" name="username"/><br/>password: <input type="password" name="password"/><br/><input type="button" value="提交" οnclick="form01();"/></form></body>
<script type="text/javascript">//使用button进行表单的提交function form01() {//得到form标签var form01 = document.getElementById("form01");//提交form表单form01.submit();}
</script>
</html>
第三种:直接使用get网址 进行超链接提交
<pre name="code" class="html"><a href="html?username=ccc&password=123456">超链接提交数据</a>
本文标签: form表单提交三种方式,demo实例详解
版权声明:本文标题:form表单提交三种方式,demo实例详解 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.roclinux.cn/b/1686652590a20655.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论