HTML DOM स्क्रिप्ट ऑब्जेक्ट
स्क्रिप्ट ऑब्जेक्ट
स्क्रिप्ट ऑब्जेक्ट एक HTML <script> तत्व का प्रतिनिधित्व करता है।
एक स्क्रिप्ट ऑब्जेक्ट तक पहुंचें
आप getElementById() का उपयोग करके <script> तत्व तक पहुंच सकते हैं:
उदाहरण
var x = document.getElementById("myScript");
युक्ति: आप स्क्रिप्ट संग्रह का उपयोग करके <script> तत्व तक भी पहुंच सकते हैं ।
एक स्क्रिप्ट वस्तु बनाएँ
आप document.createElement() विधि का उपयोग करके एक <script> तत्व बना सकते हैं:
उदाहरण
var x = document.createElement("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 |
मानक गुण और घटनाएँ
स्क्रिप्ट ऑब्जेक्ट मानक गुणों और घटनाओं का भी समर्थन करता है ।
संबंधित पृष्ठ
एचटीएमएल संदर्भ: एचटीएमएल <स्क्रिप्ट> टैग