html 表单按钮与输入类型=“提交”与 this.submit() 相比?
在表单上添加提交按钮的正确符合标准的语义方式是什么?我不需要按钮中的图像或背景,只需要简单的文本,也许是带有弯角的渐变背景(使用CSS3)。这些是我所知道的方法:
<input type="submit" value="click here"/>
<button>click here</button>
<span class="button">click here</span>
<script>
$('.button').click(function() {
this.submit();
}
</script>
我认为 input type="submit" 是正确的按钮,因为这就是它的设计目的?
What is the proper standards compliant semantic way to have a submit button on a form? I don't need images or backgrounds in the buttons, just simple text, maybe a gradient background with curved corners (using CSS3). These are the ways I know of:
<input type="submit" value="click here"/>
<button>click here</button>
<span class="button">click here</span>
<script>
$('.button').click(function() {
this.submit();
}
</script>
I would think input type="submit" is the proper button since that's what it was designed for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标准当然是使用
如果禁用 javascript,则具有 javascript 函数的按钮将不再工作,
其行为方式相同作为提交按钮,如果您需要图像来使其更加精美,如果您懒惰使用 CSS 对其进行样式化的
话,在您的情况下,我假设您很难对提交按钮进行样式化。如果是这样,那么这是我一直在使用的 参考,直到 jquery-ui 出现。
The standard is of course using the
<input type="submit" value="click here"/>
A button with a javascript function wouldn't work anymore if javascript is disabled
behaves the same way as a submit button if ever you need images to make it more fancy if you are lazy to style it with CSS
In your case, I assume that you are having a hard time styling the submit button. If so then here's the reference I always have been using until jquery-ui came into the scene.