角色="演示"在

时间:2017-10-24 16:43:14

标签: javascript html bootstrap-4

<nav>
    <ul class="nav nav-pills pull-right">
        <li role="presentation">
            <form action="/logout" method="POST" id="logout-form">
                <a href="#" onClick="document.getElementById('logout-form').submit()">Logout</a>
            </form>
        </li>
        <li role="presentation"><a href="/login">Login</a></li>
        <li role="presentation"><a href="/register">Register</a></li>
    </ul>
</nav>

表单链接的设计不正确。有人知道我能尝试什么吗?

1 个答案:

答案 0 :(得分:0)

实际上答案非常明显......

<form action="/logout" method="POST" id="logout-form"></form>

<li role="presentation">
    <a href="#" onClick="document.getElementById('logout-form').submit()">Logout</a>
</li>
<li role="presentation"><a href="/login">Login</a></li>
<li role="presentation"><a href="/register">Register</a></li>