使用普通链接提交表单 [英] Use a normal link to submit a form

查看:25
本文介绍了使用普通链接提交表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提交一个表格.但我不会使用带有提交类型的输入按钮,而是使用 a 链接的基本方法.

I want to submit a form. But I am not going the basic way of using a input button with submit type but a a link.

下图说明了原因.我正在使用图像链接来保存/提交表单.因为我有图像链接的标准 css 标记,所以我不想使用输入提交按钮.

The image below shows why. I am using image links to save/submit the form. Because I have standart css markup for image links I don't want to use input submit buttons.

我尝试将 onClick="document.formName.submit()" 应用于 a 元素,但我更喜欢 html 方法.

I tried to apply onClick="document.formName.submit()" to the a element but I would prefer a html method.

有什么想法吗?

推荐答案

两种方式.创建一个按钮并设置样式,使其看起来像一个带有 css 的链接,或者创建一个链接并使用 onclick="this.closest('form').submit();return false;".

Two ways. Either create a button and style it so it looks like a link with css, or create a link and use onclick="this.closest('form').submit();return false;".

这篇关于使用普通链接提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆