//Window對象 //屬性 object window.navigator; //返回Navigator對象引用 object window.screen; //返回Screen對象引用 object window.history; //返回History對象引用 object window.location; //返回Location對象引用 object window.document; //返回Document對象引用 object window.localStorage; //返回沒過時的storage數據 object window.sessionStorage; //返回一個session的storage數據 string window.name; //設置或返回窗口的名稱 int window.length; //設置或返回窗口中的框架數量 array window.frames; //返回窗口中全部框架 object window.opener; //返回對建立此窗口的窗口的引用 bool window.closed; //返回窗口是否已關閉 object window.self; //返回自身窗口對象 object window.parent; //返回父窗口對象 object window.top; //返回頂層窗口對象 int window.innerHeight; //返回窗口文檔顯示區的高度 int window.innerWidth; //返回窗口文檔顯示區的寬度 int window.outerHeight; //返回窗口的外部高度(瀏覽器高度) int window.outerWidth; //返回窗口的外部寬度(瀏覽器寬度) int window.pageXOffset; //返回當前頁面滾過的寬度 int window.pageYOffset; //返回當前頁面滾過的高度 int window.screenLeft; //返回瀏覽器左上角在屏幕的X座標 int window.screenTop; //返回瀏覽器左上角在屏幕的Y座標 int window.screenX; //同window.screenLeft int window.screenY; //同window.screenTop //方法 void window.alert([string message]); //彈出一個警告框顯示信息message bool window.confirm([string message]); //彈出一個確認框顯示信息message 點擊肯定返回true 不然返回false string window.prompt([string message, string text]); //彈出一個輸入框顯示信息message和defaultText 返回用戶輸入 void window.print(); //打印當前窗口的內容 void window.blur(); //把鍵盤焦點從頂層移開 void window.focus(); //把鍵盤焦點給予一個窗口 string window.btoa(string str); //返回對字符串str進行base64編碼後的字符串 string window.atob(string str); //返回base64解碼後的字符串 void window.scrollTo(x,y); //移動橫豎滾動條到指定的位置 滾動條可見屬性必須爲true void window.scrollBy(x,y); //指定滾動條移動的像素 滾動條可見屬性必須爲true void window.stop(); //中止當前頁面的加載 和瀏覽器中止加載按鈕同樣 //每millisec毫秒運行一次函數func 返回這個定時器標識 param1,param2指定傳遞給函數func的參數 int window.setInterval(function func, int millisec, [mixed param1, mixed param2, ...]); //等待millisec毫秒後運行一次函數func int window.setTimeout(function func, int millisec, [mixed param1, mixed param2, ...]); void window.clearInterval(int id); //清除標識id的setInterval定時器 void window.clearTimeout(int id); //清除標識id的setTimeout定時器 object window.open([string url, string name, string specs, bool replace]); //打開一個新的瀏覽器窗口 void window.close(); //關閉由open()打開的窗口 void window.moveTo(x,y); //將open()打開的窗口左上角移動到一個指定的座標 void window.moveBy(x,y); //將open()打開的窗口相對窗口的當前座標把它移動的像素 void window.resizeTo(width,height); //將open()打開的窗口的大小調整到指定的大小 void window.resizeBy(width,height); //將open()打開的窗口的右下角移動的像素
//Navigator對象 Navigator 對象包含有關瀏覽器的信息。 //屬性 string navigator.appCodeName; //返回瀏覽器代碼名 只讀字符串 string navigator.appName; //返回瀏覽器的名稱 只讀字符串 string navigator.appVersion; //返回瀏覽器的平臺和版本 只讀字符串 string navigator.language; //返回瀏覽器使用的語言 只讀字符串 string navigator.platform; //返回運行瀏覽器的操做系統 只讀字符串 string navigator.product; //返回瀏覽器的引擎名稱 只讀字符串 string navigator.userAgent; //返回用於http的userAgent值 只讀字符串 bool navigator.cookieEnabled; //檢查瀏覽器是否啓用cookie bool navigator.onLine; //檢查瀏覽器是否在線 object navigator.geolocation; //返回一個定位對象 //方法 bool navigator.javaEnabled(); //檢查瀏覽器是否啓用了Java
//Screen對象 Screen 對象包含有關客戶端顯示屏幕的信息。 //屬性 int screen.availHeight; //返回瀏覽器可用的屏幕高度 int screen.availWidth; //返回瀏覽器可用的屏幕寬度 int screen.height; //返回屏幕的總高度 int screen.width; //返回屏幕的總寬度 int screen.colorDepth; //返回應用程序使用的色深 int screen.pixelDepth; //返回屏幕的色深
//History對象 History 對象包含用戶(在瀏覽器窗口中)訪問過的 URL。 //屬性 int history.length; //返回瀏覽器歷史列表中的元素數量 //方法 void history.back(); //加載歷史列表中的上一個URL(若是存在) 等價後退按鈕和history.go(-1) void histroy.forward(); //加載歷史列表中的下一個URL(若是存在) 等價前進按鈕和history.go(1) void history.go(mixed val); //加載指定的歷史頁面 val可爲數字 或者url局部或完整字符串
//Location對象 Location 對象包含有關當前 URL 的信息。 //屬性 string location.href; //設置或返回完整的url 設置格式: location.href = URL string location.protocol; //設置或返回當前url的協議部分 設置格式: location.protocol = protocol string location.hostname; //設置或返回當前url的主機名部分 設置格式: location.hostname = hostname string location.port; //設置或返回當前url的端口部分 設置格式: location.port = port string location.pathname; //設置或返回當前url的路徑部分 設置格式: location.pathname = path string location.search; //設置或返回當前url的查詢部分(?name=value) 設置格式: location.search = queryString string location.hash; //設置或返回當前url的錨部分(#value) 設置格式: location.hash = value string location.host; //設置或返回當前url的主機名和端口(端口爲80、443將不顯示) 設置格式: location.host = hostname:port string location.origin; //返回當前url的協議、主機名、端口 //方法 void location.assign(string url); //載入新文檔url void location.replace(string url); //使用新文檔url替換當前url(將替換歷史列表url) void location.reload([bool get]); //從新載入當前文檔 若是get設置爲true則會繞過緩存