用文本替换提交按钮?
我希望用文本替换表单上标准的丑陋提交按钮。我知道如何通过将提交更改为以下内容来将其替换为图像:
<input type="image" name="submit" src="submit.png" width="70px" height="30px">
但我想将其更改为文本,这可能吗? 谢谢
I'm hoping to replace the standard ugly submit button on my form with text. I know how to replace it with an image by changing the submit to this:
<input type="image" name="submit" src="submit.png" width="70px" height="30px">
But I would like to change it to text, is this possible?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用带有 javascript 的锚标记来触发表单更改。例如,
顺便说一句,您还可以使用几乎任何文本标记,只需绑定到 onclick 事件(例如
)。
you can use an anchor tag with javascript to trigger the form change. e.g.
You could also use almost any textual tag, by the way, just binding to the onclick event (a
<span>
for instance).不,您需要使用不同的 HTML 实体(即,只是一个链接)。
但是,我建议你不要改变它。从用户体验的角度来看,最好使用典型的提交按钮,如果合适的话,可以稍微调整一下样式,但仍然尽可能接近“典型”。
原因是操作系统以不同(并且熟悉)的方式向用户显示按钮,并且遵循“标准”是良好的 UI 设计实践。这只是我的拙见。
从技术上讲,您可以通过将
onclick
事件设置为适当的值(例如:onclick="return doFormSubmit();"
),轻松创建一个执行表单提交的链接。No, you need to use a different HTML entity (i.e, just a link).
But, I'd recommend you don't change it. It's better, from a user experience point of view, to use the typical submit buttons, perhaps styled slightly if appropriate, but nevertheless remaining as close to 'typical' as possible.
The reasoning is that OS' display the button in different (and familiar) ways to the user, and it's good UI design practice to follow "standards". This iy just my humble opinion.
Technically, you can quite easily make a link do the form submission, by setting the
onclick
event to something appropriate (like:onclick="return doFormSubmit();"
).是的,用 Javascript 是可以的,尽管你可能不应该这样做。用户不希望在单击链接时发布表单。
Yes, it's possible with Javascript, though you probably shouldn't do it. Users don't expect forms to be posted upon clicking a link.
您可以使用标准按钮完成相同的操作,但使用 CSS 来删除边框。它看起来就像文本一样。
You can accomplish the same thing with a standard button, but use CSS to remove the border. It will look just like text.