HTML <script> ketik Atribut

tag <script> HTML

Contoh

Skrip dengan atribut type yang ditentukan:

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

Definisi dan Penggunaan

Atribut typemenentukan jenis skrip.

Atribut typemengidentifikasi konten antara <script>dan </script>tag.


Dukungan Peramban

Attribute
type Yes Yes Yes Yes Yes

Sintaksis

<script type="scripttype">

Nilai 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.


tag <script> HTML