Oggetto script DOM HTML
Oggetto script
L'oggetto Script rappresenta un elemento HTML <script>.
Accedi a un oggetto script
Puoi accedere a un elemento <script> usando getElementById():
Esempio
var x = document.getElementById("myScript");
Suggerimento: puoi anche accedere a un elemento <script> utilizzando la raccolta di script .
Crea un oggetto script
Puoi creare un elemento <script> usando il metodo document.createElement():
Esempio
var x = document.createElement("SCRIPT");
Proprietà dell'oggetto script
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 |
Proprietà ed eventi standard
L'oggetto Script supporta anche le proprietà e gli eventi standard .
Pagine correlate
Riferimento HTML: tag HTML <script>