English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Führt JavaScript aus, wenn das <details>-Element geöffnet oder geschlossen wird:
<!DOCTYPE html> <html> <head> <title>Verwendung des HTML ontoggle-Event-Attributs (Basis-Tutorial-Web oldtoolbag.com)</title>/title> <style> div { background: yellow; border: 1px solid #cccccc; padding: 10px; } </style> </head> <body> <p>Öffnen Sie die Details.</p> <details ontoggle="myFunction()"> <summary>Urheberrecht 1999-2019.</summary> <p> - Alle Rechte vorbehalten./p> <p>Details und Absätze werden hier dargestellt.../p> </details> <p><strong>Hinweis:</Der ontoggle-Event-Attribut wird von Chrome und Safari unterstützt 6+, und Opera 15+.</p> <script> function myFunction() { alert("ontoggle event triggered"); } </script> </body> </html>Test to see ‹/›
When the user opens or closes the <details> element, the ontoggle attribute is triggered.
The <details> element specifies other detailed information that the user can view or hide as needed.
IEFirefoxOperaChromeSafari
In HTML5In, the ontoggle attribute is newly added.
<element ontoggle="script">
Value | Description |
---|---|
script | Script is executed in ontoggle |
Supported HTML Tags: | <details> |
---|
HTML DOM Reference Manual: ontoggle Event