zoukankan      html  css  js  c++  java
  • button点击按钮触发提交from表单数据

    1.html代码

    <form method="post" action="/xxx/" id="filter_all" >
        {% csrf_token %}
        <select name="filter_platform" id="filter_platform" style="height: 30px;border: 0; 250px;border-radius: 7px;background-color: #e2e2f5;">
            <option value="" style="display: none;" disabled selected>平台:{{ filter_platform }}</option>
            {% for server_host_type in server_host_type_list %}
                <option value="{{ server_host_type }}">{{ server_host_type }}</option>
            {% endfor %}
        </select>
        <select name="filter_accoount" id="filter_accoount" style="height: 30px;border: 0; 250px;border-radius: 7px;background-color: #e2e2f5;">
            <option value="" style="display: none;" disabled selected>账号:{{ filter_accoount }}</option>
            {% for account in accoount_list %}
                <option value="{{ account.platform }}_{{ account.account }}({{ account.name }})">{{ account.platform }}_{{ account.account }}({{ account.name }})</option>
            {% endfor %}
        </select>
        <select name="filter_project" id="filter_project" style="height: 30px;border: 0; 250px;border-radius: 7px;background-color: #e2e2f5;">
            <option value="" style="display: none;" disabled selected>项目:{{ filter_project }}</option>
            {% for project in project_list %}
                <option value="{{ project.id }}">{{ project.name }}</option>
            {% endfor %}
        </select>
        <button class="layui-btn layui-btn-small" style="height: 30px;line-height:1.6em;" title="筛选" onclick="submitForm_filter_platform()">
            <i class="layui-icon" style="line-height:32px;font-size: 14px;">筛选</i>
        </button>
    </form>

    2.javascript代码

    function submitForm_filter_platform(){
        //获取form表单对象,提交选择项目
        var form = document.getElementById("filter_all");
        form.submit();//form表单提交
    }
  • 相关阅读:
    暂存未看的网址
    学习springboot+shiro的实际应用demo
    mapper.xml 的配置
    使用idea搭建Spring boot+jsp的简单web项目
    一文读懂SpringCloud与Eureka,Feign,Ribbon,Hystrix,Zuul核心组件间的关系
    .net core mvc 类库读取配置文件
    .net Core 2.0应用程序发布到IIS上注意事项
    Dapper扩展
    C# 请求Https
    js 记录
  • 原文地址:https://www.cnblogs.com/chenjw-note/p/12703596.html
Copyright © 2011-2022 走看看