คุณสมบัติชุดอักขระสคริปต์
ตัวอย่าง
รับชุดอักขระที่ใช้ในไฟล์สคริปต์ภายนอก:
var x = document.getElementById("myScript").charset
ความหมายและการใช้งาน
ชุดคุณสมบัติชุดอักขระหรือคืนค่าของแอตทริบิวต์ชุดอักขระของสคริปต์
แอตทริบิวต์ชุดอักขระระบุการเข้ารหัสอักขระที่ใช้ในไฟล์สคริปต์ภายนอก
แอตทริบิวต์ชุดอักขระจะใช้เมื่อการเข้ารหัสอักขระในไฟล์สคริปต์ภายนอกแตกต่างจากการเข้ารหัสในเอกสาร HTML
หมายเหตุ:แอตทริบิวต์ชุดอักขระใช้สำหรับสคริปต์ภายนอกเท่านั้น (ใช้ได้เฉพาะเมื่อมีแอตทริบิวต์ src อยู่)
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
charset | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติชุดอักขระ:
scriptObject.charset
ตั้งค่าคุณสมบัติชุดอักขระ:
scriptObject.charset = charset
มูลค่าทรัพย์สิน
Value | Description |
---|---|
charset | Specifies the character encoding of an external script file.
Some common values:
Look at our Character-sets reference for a complete list of character sets. |
รายละเอียดทางเทคนิค
คืนมูลค่า: | สตริงที่แทน URL ของไฟล์สคริปต์ภายนอก ส่งกลับ URL ทั้งหมด รวมทั้งโปรโตคอล (เช่น http://) |
---|
หน้าที่เกี่ยวข้อง
การอ้างอิง HTML: HTML <script> แอตทริบิวต์ชุดอักขระ
❮ วัตถุสคริปต์