[go: up one dir, main page]

    1. 4.12 Scripting
      1. 4.12.1 The script element
        1. 4.12.1.1 Scripting languages
        2. 4.12.1.2 Restrictions for contents of script elements
        3. 4.12.1.3 Inline documentation for external scripts
      2. 4.12.2 The noscript element
      3. 4.12.3 The template element
      4. 4.12.4 The slot element

4.12 Scripting

Scripts allow authors to add interactivity to their documents.

Authors are encouraged to use declarative alternatives to scripting where possible, as declarative mechanisms are often more maintainable, and many users disable scripting.

For example, instead of using a script to show or hide a section to show more details, the details element could be used.

Authors are also encouraged to make their applications degrade gracefully in the absence of scripting support.

For example, if an author provides a link in a table header to dynamically resort the table, the link could also be made to function without scripts by requesting the sorted table from the server.

4.12.1 The script element

HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code. The