欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript獲取當(dāng)前網(wǎng)頁標(biāo)題(title)的方法

 更新時(shí)間:2015年04月03日 10:22:21   作者:瘋狂一夏  
這篇文章主要介紹了JavaScript獲取當(dāng)前網(wǎng)頁標(biāo)題(title)的方法,涉及javascript中document.title方法的使用,需要的朋友可以參考下

本文實(shí)例講述了JavaScript獲取當(dāng)前網(wǎng)頁標(biāo)題(title)的方法。分享給大家供大家參考。具體如下:

JS中的document.title可以獲取當(dāng)前網(wǎng)頁的標(biāo)題

<!DOCTYPE html>
<html>
<head>
<title>jb51.net</title>
</head>
<body>
current document's title is:
<script>
document.write(document.title);
</script>
</body>
</html>

運(yùn)行結(jié)果如下:

current document's title is:jb51.net

如何用js代碼修改與讀取網(wǎng)頁標(biāo)題呢,本節(jié)為大家提供一例代碼。
在ie6和ff2.0下測試通過。

代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>標(biāo)題一</title>
</head>
<body>
<script type="text/javascript">
<!--
var t=document.title;
alert(t);
document.title="改變的標(biāo)題二";
//-->
</script>
</body>
</html>

希望本文所述對大家的javascript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論