ชื่อเมตาพร็อพเพอร์ตี้
ตัวอย่าง
ส่งคืนค่าแอตทริบิวต์เนื้อหาขององค์ประกอบเมตาทั้งหมด:
var x = document.getElementsByTagName("META");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
txt = txt + "Name of "+(i+1)+". meta tag: "+x[i].name+"<br>";
}
ความหมายและการใช้งาน
คุณสมบัติ name ตั้งค่าหรือส่งคืนชื่อสำหรับข้อมูลในแอตทริบิวต์เนื้อหา
ค่าของแอตทริบิวต์ชื่อขึ้นอยู่กับค่าของแอตทริบิวต์เนื้อหา
นอกจากนี้ยังมีรายการเพิ่มเติมที่กำหนดไว้ในหน้า WHATWG Wiki MetaExtensions - ทุกคนสามารถแก้ไขหน้าได้ตลอดเวลาเพื่อเพิ่มประเภทใหม่ ไม่มีการยอมรับอย่างเป็นทางการ แต่อาจมีในอนาคต สำหรับข้อมูลเพิ่มเติม โปรดไป ที่หน้า WHATWG Wiki MetaExtensions
หมายเหตุ:หากมีการตั้งค่าแอตทริบิวต์ http-equiv ไว้ ไม่ควรตั้งค่าแอตทริบิวต์ชื่อ
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
name | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติชื่อ:
metaObject.name
ตั้งค่าคุณสมบัติชื่อ:
metaObject.name = "application-name|author|description|generator|keywords"
Value | Description |
---|---|
application-name | Specifies the name of the Web application that the page represents |
author | Specifies the name of the author of the document. Example: <meta name="author" content="Hege Refsnes"> |
description | Specifies a description of the page. Search engines can pick up this description to show with the results of searches. Example: <meta name="description" content="Free web tutorials"> |
generator | Specifies one of the software packages used to generate the document (not used on hand-authored pages) Example: <meta name="generator" content="FrontPage 4.0"> |
keywords | Specifies a comma-separated list of keywords - relevant to the page (Informs search engines what the page is about). Tip: Always specify keywords (needed by search engines to catalogize the page). Example: <meta name="keywords" content="HTML, meta tag, tag reference"> |
คืนมูลค่า
Type | Description |
---|---|
String | A name for the information in the content attribute |
❮ วัตถุ Meta