久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網
      最全最豐富的資訊網站

      javascript怎么設置title

      在javascript中,可以利用title屬性來設置title;title屬性可以設置或返回元素的標題,語法格式“document.title ="title值"”

      javascript怎么設置title

      本教程操作環(huán)境:windows7系統(tǒng)、ECMAScript 5版、Dell G3電腦。

      title在html中屬于特殊的節(jié)點元素.因為它可以使用doucment.getElementsByTagName("title")[0]來獲取它的標題,但卻無法用doucment.getElementsByTagName("title")[0]用更改它的值.

      但是,總有解決的方法,在javascript中,,修改title的方法是:

      document.title = 'xxxxxx' ;

      示例:

      <!DOCTYPE html> <html>  	<head> 		<meta charset="utf-8"> 		<title>舊標題,需要修改</title> 	</head>  	<body> 		<script> 			document.title = "新標題"; 		</script> 	 </ody> </html>

      效果圖:

      javascript怎么設置title

      <body></body>之間的節(jié)點元素用document.getElementsByTagName()來獲取或修改;documentElement代表的是<html></html>中間的所有東西.

      js會使用document.title來代替網頁的title的原因是:title、head、body等標簽是缺省的唯一標簽,所以 document.titledocument.body可以直接找到結果。

      而title是一個結構的標簽,也就是說title內,只能加入nodetext;而不能再加別的元素。于是它的使用又具有 特殊性。為了不讓代碼出錯,于是js中規(guī)定document.title這個對象只有一個屬性(也可以說是沒有屬性),document.title本身就是document對象的一個屬性,而不是它的一個子對象,于用document.title=""來更改title。

      贊(0)
      分享到: 更多 (0)
      網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號