HTML DOM Komut Dosyası Nesnesi
Komut Dosyası Nesnesi
Script nesnesi bir HTML <script> öğesini temsil eder.
Bir Komut Dosyası Nesnesine Erişme
Bir <script> öğesine getElementById() kullanarak erişebilirsiniz:
Örnek
var x = document.getElementById("myScript");
İpucu: Bir <script> öğesine, komut dosyaları koleksiyonunu kullanarak da erişebilirsiniz .
Bir Komut Dosyası Nesnesi Oluşturun
Document.createElement() yöntemini kullanarak bir <script> öğesi oluşturabilirsiniz:
Örnek
var x = document.createElement("SCRIPT");
Komut Dosyası Nesne Özellikleri
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 |
Standart Özellikler ve Olaylar
Script nesnesi ayrıca standart özellikleri ve olayları da destekler .
İlgili Sayfalar
HTML referansı: HTML <script> etiketi