HTML DOM Script Object






<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



HTML DOM Script Object



❮ Previous
Next ❯



Script Object


The Script object represents an HTML <script> element.


Access a Script Object


You can access a <script> element by using getElementById():



Example



var x = document.getElementById("myScript");

Try it Yourself »

Tip: You can also access a <script> element by using the scripts collection.



Create a Script Object


You can create a <script> element by using the document.createElement() method:



Example



var x = document.createElement("SCRIPT");

Try it Yourself »

Script Object Properties




= Property added in HTML5.


































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

Standard Properties and Events


The Script object also supports the standard properties and events.




Related Pages


HTML reference: HTML <script> tag





❮ Previous
Next ❯

Popular posts from this blog

Greedy Best First Search implementation in Rust

Function to Return a JSON Like Objects Using VBA Collections and Arrays

C++11 CLH Lock Implementation