HTML DOM Skrip Voorwerp
Skripvoorwerp
Die Skrip-objek verteenwoordig 'n HTML <script>-element.
Toegang tot 'n Skripvoorwerp
Jy kan toegang tot 'n <script>-element kry deur getElementById():
Voorbeeld
var x = document.getElementById("myScript");
Wenk: Jy kan ook toegang tot 'n <script>-element kry deur die skrifteversameling te gebruik .
Skep 'n Skripobjek
Jy kan 'n <script> element skep deur die document.createElement() metode te gebruik:
Voorbeeld
var x = document.createElement("SCRIPT");
Skripvoorwerpeienskappe
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 |
Standaard eiendomme en geleenthede
Die Skrip-objek ondersteun ook die standaard eienskappe en gebeurtenisse .
Verwante bladsye
HTML verwysing: HTML <script> tag