Атрибут типа HTML <script>

❮ HTML-тег <script>

Пример

Скрипт с указанным атрибутом type:

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

Определение и использование

Атрибут typeуказывает тип скрипта.

Атрибут typeидентифицирует содержимое между тегами <script>и .</script>


Поддержка браузера

Attribute
type Yes Yes Yes Yes Yes

Синтаксис

<script type="scripttype">

Значения атрибутов

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-тег <script>