Objeto de secuencia de comandos HTML DOM
Objeto de secuencia de comandos
El objeto Script representa un elemento HTML <script>.
Acceder a un objeto de secuencia de comandos
Puede acceder a un elemento <script> usando getElementById():
Ejemplo
var x = document.getElementById("myScript");
Sugerencia: también puede acceder a un elemento <script> utilizando la colección de scripts .
Crear un objeto de secuencia de comandos
Puede crear un elemento <script> utilizando el método document.createElement():
Ejemplo
var x = document.createElement("SCRIPT");
Propiedades del objeto de secuencia de comandos
Property | Description |
---|---|
async | Sets or returns whether a script should be executed asynchronously as soon as it is available |
charset | Sets or returns the value of the charset attribute of a script |
crossOrigin | Sets or returns the the CORS settings of a script |
defer | Sets or returns whether a script should be executed when the page has finished parsing |
src | Sets or returns the value of the src attribute of a script |
text | Sets or returns the contents of all the text nodes that are children of a script |
type | Sets or returns the value of the type attribute of a script |
Propiedades y eventos estándar
El objeto Script también admite las propiedades y los eventos estándar .
páginas relacionadas
Referencia HTML: etiqueta HTML <script>