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

button点击按钮触发提交from表单数据

时间:2020-04-15 11:11:23      阅读:306      评论:0      收藏:0      [点我收藏+]

标签:filter   submit   cte   line   button点击   layui   ntb   代码   筛选   

1.html代码

<form method="post" action="/xxx/" id="filter_all" >
    {% csrf_token %}
    <select name="filter_platform" id="filter_platform" style="height: 30px;border: 0;width: 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;width: 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;width: 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表单提交
}

 

button点击按钮触发提交from表单数据

标签:filter   submit   cte   line   button点击   layui   ntb   代码   筛选   

原文地址:https://www.cnblogs.com/chenjw-note/p/12703596.html

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