HTML DOM title 屬性
定義和用法
title 屬性可設(shè)置或返回對(duì)元素的描述性短語(yǔ)。
語(yǔ)法
bodyObject.title=title
實(shí)例
下面的例子將展示設(shè)置 <body> 元素的 title 屬性的兩種方法:
<html> <body id="myid" title="mytitle"> <script type="text/javascript">x=document.getElementsByTagName('body')[0];
document.write("Body title: " +x.title
); document.write("<br />"); document.write("An alternate way: "); document.write(document.getElementById('myid').title
); </script> </body> </html>
輸出:
Body title: mytitle An alternate way: mytitle