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:
Look at IANA Media Types for a complete list of standard media types. |
❮ แท็ก HTML <script>