ข้อมูลอ้างอิงHTML

HTML โดยตัวอักษร HTML ตามหมวดหมู่ รองรับ HTML Browser แอตทริบิวต์ HTML HTML Global Attributes เหตุการณ์ HTML HTML สี HTML Canvas HTML เสียง/วิดีโอ ชุดอักขระ HTML HTML Doctypes การเข้ารหัส URL HTML รหัสภาษา HTML รหัสประเทศ HTML ข้อความ HTTP วิธี HTTP ตัวแปลง PX เป็น EM แป้นพิมพ์ลัด


HTML <script> ประเภทแอตทริบิวต์

❮ แท็ก HTML <script>

ตัวอย่าง

สคริปต์ที่มีแอตทริบิวต์ type ที่ระบุ:

<script type="application/javascript">
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>

ความหมายและการใช้งาน

แอตทริบิวต์typeระบุประเภทของสคริปต์

แอตทริบิวต์typeระบุเนื้อหาระหว่างแท็ก <script>และ</script>


รองรับเบราว์เซอร์

Attribute
type Yes Yes Yes Yes Yes

ไวยากรณ์

<script type="scripttype">

ค่าแอตทริบิวต์

Value Description
scripttype Specifies the type of the script.

Some common values:
  • A JavaScript MIME type like: application/javascript (default) or application/ecmascript
  • module:
  • Another MIME type. src attribute will be ignored

Look at IANA Media Types for a complete list of standard media types.


❮ แท็ก HTML <script>