哪些HTML标签可以与onClick一起使用? [英] Which HTML tags can be used with onClick?

查看:1299
本文介绍了哪些HTML标签可以与onClick一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些标签可以有 onClick 功能,哪些不可以?如果有任何我不能包含 onClick 的功能,为什么不呢?

Which tags can have an onClick function, and which cannot? If there are any where I cannot include an onClick function, why not?

onClick="func()"

您是否应该遵守任何规则?

Are there any rules that you should adhere to?

推荐答案

所有HTML元素都可以有 onclick 属性。

All HTML elements can have an onclick attribute.

请参阅 HTML 5规范进行确认。

(当然,默认情况下不会呈现某些元素,因此您必须使用CSS更改其 display 属性在点击它们之前触发事件处理程序。)

(Of course, some elements are not rendered by default so you would have to alter their display properties with CSS before they can be clicked on to trigger the event handler).

这篇关于哪些HTML标签可以与onClick一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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