Atributo de tipo HTML <script>

❮ Etiqueta HTML <secuencia de comandos>

Ejemplo

Un script con el atributo de tipo especificado:

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

Definición y uso

El typeatributo especifica el tipo de script.

El typeatributo identifica el contenido entre las etiquetas <script>y .</script>


Compatibilidad con navegador

Attribute
type Yes Yes Yes Yes Yes

Sintaxis

<script type="scripttype">

Valores de atributo

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.


❮ Etiqueta HTML <secuencia de comandos>