close
document的成員變數:使用document.成員變數名稱來存取。常用成員變數名稱如下:
(1) cookie
在「cookie」該章節有專門介紹:
(2) domain:網域名稱。在本機伺服器測試中,如:
document.write(document.domain); //顯示:localhost
(3) lastModified:網頁文件最後被使用者使用、或被設計者修改的時間。如:
<input type="button" value="按下" onclick="document.getElementById('tt').value=document.lastModified"/>
<input id="tt" type="text" /> //執行,按下按鈕,顯示如:01/19/2014 23:39:15
(4) title:網頁文件標題。設定標題的方法如:
document.title=”標題名稱”;
這一行會覆蓋掉<title>標題名稱</title>的設定。
註:若沒有用document.title=”標題名稱”;設定標題名稱,而想要用document.write(document.title);來讀取標題名稱,則document.write(document.title);必須寫在<title>標題名稱</title>之後。
(5) URL:網頁的URL位址。如:
document.write(document.URL); //顯示:http://localhost/phptt/test1.php
文章標籤
全站熱搜