html - 如何使用 <a href ="..."> 标签提交 POST 表单?

标签 html forms jsp

如何将 POST 表单提交到 showMessage.jsp仅使用 <a href="...">标签?

<form action="showMessage.jsp" method="post">
    <a href="showMessage.jsp"><%=n%></a>
    <input type="hidden" name="mess" value=<%=n%>/>
</form>

最佳答案

如果您改用按钮,则不需要 JavaScript:

<form action="your_url" method="post">
    <button type="submit" name="your_name" value="your_value" class="btn-link">Go</button>
</form>

您可以 style a button to look like a link ,例如:

.btn-link {
    border: none;
    outline: none;
    background: none;
    cursor: pointer;
    color: #0000EE;
    padding: 0;
    text-decoration: underline;
    font-family: inherit;
    font-size: inherit;
}

关于html - 如何使用 <a href ="..."> 标签提交 POST 表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8169027/

相关文章:

javascript - 如何在html中自动排序复选框列表

html - 标签中的 "for"是什么意思?

javascript - AngularJS 多步表单验证

java - 为什么 java 代码不将文本转换为 utf8 字符?

html - 响应图像在移动设备上缩放太大

jquery - 元素背景,颜色和图像,这可能吗?

javascript - 在 geo div 中,如何添加 else show #other-country

php - 什么会导致 $_FILES ['file' ] ['name' ] 为空?

javascript - 将 ArrayList 传递给 JQuery Flot

javascript - 如何通过javascript函数调用DAO方法?