HTML DOM title 属性

定义和用法

title 属性可设置或返回对元素的描述性短语。

语法

bodyObject.title=title

实例

下面的例子将展示设置 <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
系统帮助 | 给我留言 | 收藏本站
Copyright © 2005-2008 www.cnn84.com All Rights Reserved Ver:2.0 桂公网安备45122402000102号
CNN84网是公益性便民网站,是为了给大家的日常生活查询及提供最快捷的出行指南
晚上好!CNN84祝你今晚玩的愉快!天天都有新收获!