Propiedad de juego de caracteres de secuencia de comandos
Ejemplo
Obtenga el conjunto de caracteres utilizado en un archivo de script externo:
var x = document.getElementById("myScript").charset
Definición y uso
La propiedad charset establece o devuelve el valor del atributo charset de un script.
El atributo charset especifica la codificación de caracteres utilizada en un archivo de script externo.
El atributo charset se usa cuando la codificación de caracteres en un archivo de script externo difiere de la codificación en el documento HTML.
Nota: El atributo charset es solo para scripts externos (solo se puede usar si el atributo src está presente).
Compatibilidad con navegador
Property | |||||
---|---|---|---|---|---|
charset | Yes | Yes | Yes | Yes | Yes |
Sintaxis
Devuelve la propiedad charset:
scriptObject.charset
Establezca la propiedad charset:
scriptObject.charset = charset
Valores de propiedad
Value | Description |
---|---|
charset | Specifies the character encoding of an external script file.
Some common values:
Look at our Character-sets reference for a complete list of character sets. |
Detalles técnicos
Valor de retorno: | Una cadena, que representa la URL del archivo de script externo. Devuelve la URL completa, incluido el protocolo (como http://) |
---|
páginas relacionadas
Referencia de HTML: atributo de conjunto de caracteres HTML <script>
❮ Objeto de guión