HTML事件属性onggle

2018-01-05 13:58 更新

HTML事件属性onggle


触发 ontoggle 属性事件当打开或关闭< details> 元件。

HTML5中的新功能

ontoggle 属性在HTML5中是新的。

句法

<details ontoggle="script">

支持的标签

<details>

浏览器兼容性

details Yes No No Yes Yes


例子

<!DOCTYPE html>
<html>
<body>


<details ontoggle="myFunction()">
    <summary>Open the summary</summary>
    <p>this is a test.</p>
</details>

<script>
function myFunction() {
    console.log("The ontoggle event occured");
}
</script>

</body>
</html>

Click to view the demo



以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号