Code
// JavaScript Document
//瀏覽器視窗在當前位置移動 水平x 像素 垂直y像素
window.moveBy(x,y);
//行動瀏覽器 視窗 使其左上方位於螢幕(x,y)處
widows.moveTo(x,y);
//調整browser大小
resizeTo(x,y);
//調整browser當前大小 正數為增加 負數為減小
resizeBy(x,y);
window.open("www.eping.net", "eping");
//window.open("URL", "name","features",boolean replace);
//features 參數 int型 left top height width
// bool值 esizeable(改變大小) scrollable toolbar location(顯示地址)
//系統對話方塊
widows.alert("message");
//確認對話方塊
window.confirm("message");
//confirm有傳回值
//當需要使用者輸入資料再確認時
var result = widows.prompt("this is prompt ", "default value"); //這個結果是可以返回的
//狀態列使用
window.status = "infomation"; //設定狀態列資訊
widows.defaultStatus = "default infomation" ;// 設定狀態列預設資訊
//時間間隔和暫停
var timeoutID = window.setTimeout(code,msNum);
//code 固定時間執行的代碼 相當於VC中的SetTimer msNum毫秒
window.clearTimeout(timeoutID);
//還可以調用
function testInterval()
{
//接收window.setInterval 返回的數字暫停ID
intervalID=window.setInterval("alert(\"今天學習時間間隔\")",1000);
}
widows.clearInterval(intervalID);
//曆吏記錄
window.history.go(-1); //負數為後退 正數為前進
widows.history.back(); //回退至前面在history中所處位置的一項曆吏記錄
window.history.forward(); //
//screen 對象
//window.screen 使用者訪問使用者的螢幕資訊
/*
availHeight 視窗可以使用的螢幕高度 以像素為基本單位
avaliWidth 同上
colorDepth 使用者螢幕顏色的位元
height
width
*/
//location 對象
//表示載入視窗的URL 同時是window性性也是document屬性
//window.location.hash() 如果該URL包含# 該方法返回 該符號後面的內容 eg:http://www.eping.net/index.html#eping 調用hash
//方法返回#eping
//host 伺服器名 eg:http://www.eping.net/index host 值為www.eping.net
//href 當前頁面完整URL
//pathname 服務名後面的部分 eg:http://www.eping.net/index 面後部分為 index
//protocol 表單URL所使用的通訊協定
//search 表單URL中查詢記字串eg:http://www.eping.net/index?username=eping search的屬性值為 ?username=eping
//reload 重新載入頁面 false 從緩衝載入頁面 true 從伺服器端載入頁面
//assign 有一個字串參數 該方法設定當前頁面location.href 為該參數
//replace() 有一個字串參數 該方法先設定當前頁面location.href 為該參數 然後從browser 記錄刪除當前頁面
//頁面跳轉
window.location.href = "www.eping.net" ;
widows.location.assign("http://www.eping.net");
window.location.reload("http://www.eping.net"); //不能後退至本頁 會自動刪除記錄
//重新載入頁面
window.location.reload();
window.location.reload(false);
//上面兩種效果是一樣的