From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/htmlelement/title/index.html | 76 ++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 files/zh-cn/web/api/htmlelement/title/index.html (limited to 'files/zh-cn/web/api/htmlelement/title/index.html') diff --git a/files/zh-cn/web/api/htmlelement/title/index.html b/files/zh-cn/web/api/htmlelement/title/index.html new file mode 100644 index 0000000000..340c56ef74 --- /dev/null +++ b/files/zh-cn/web/api/htmlelement/title/index.html @@ -0,0 +1,76 @@ +--- +title: HTMLElement.title +slug: Web/API/HTMLElement/title +translation_of: Web/API/HTMLElement/title +--- +

{{ APIRef() }}

+ +

HTMLElement.title 属性表示元素的 title。当鼠标移到节点上时,会以“工具提示”(tool tip)的弹出形式显示该属性的属性值文本。

+ +

如果一个节点没有 title 属性(attribute),默认继承其父节点的相应属性,父节点可能是从父节点的父节点继承,依此类推。

+ +

语法

+ +
var string = element.title;
+element.title = string;
+
+ +

例子

+ +
const link = document.createElement('a');
+link.innerText = '葡萄';
+link.href = 'https://en.wikipedia.org/wiki/Grape';
+link.title = '维基百科上对葡萄的描述';
+ +

浏览器兼容性

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatVersionUnknown() }}{{CompatVersionUnknown}}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{CompatVersionUnknown}}{{ CompatVersionUnknown() }}
+
-- cgit v1.2.3-54-g00ecf