HTML <script> typ Atribut

❮ HTML tag <script>

Příklad

Skript se zadaným atributem type:

<script type="application/javascript">
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>

Definice a použití

Atribut typeurčuje typ skriptu.

Atribut typeidentifikuje obsah mezi značkami <script>a .</script>


Podpora prohlížeče

Attribute
type Yes Yes Yes Yes Yes

Syntax

<script type="scripttype">

Hodnoty atributů

Value Description
scripttype Specifies the type of the script.

Some common values:
  • A JavaScript MIME type like: application/javascript (default) or application/ecmascript
  • module:
  • Another MIME type. src attribute will be ignored

Look at IANA Media Types for a complete list of standard media types.


❮ HTML tag <script>