HTML <script> typ Atrybut

❮ Znacznik HTML <script>

Przykład

Skrypt z określonym atrybutem type:

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

Definicja i użycie

typeAtrybut określa typ skryptu .

typeAtrybut identyfikuje zawartość między <script>znacznikami </script>i .


Obsługa przeglądarki

Attribute
type Yes Yes Yes Yes Yes

Składnia

<script type="scripttype">

Wartości atrybutów

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.


❮ Znacznik HTML <script>