JavaScript window對象

來源:互聯網
上載者:User

標籤:iii   ...   eid   confirm   更改   javascrip   相對   dir   name   

window對象

1.window對象是在用戶端的整個HTML文檔的根對象;代表當前的整個開啟的瀏覽器視窗,因此其屬性多用於操作瀏覽器的效果以及視窗有關的各種資訊

2.window對象屬性

a) defaultStatus預設狀態條訊息

b) status狀態條訊息

c) document當前顯示的文檔

d) location

i.開啟網站時需要使用完整的URL地址

ii.開啟與當前檔案在同一檔案夾下的本地檔案,可使用相對位址

iii.擷取的時視窗所顯示文檔的完整URL(絕對路徑);可更改window的location屬性值;

iv.document擷取當前顯示文檔的URL,且使用者不能更改document對象的location屬性

 

3.window對象方法

a) alert()開啟訊息框

i.Window.alert(“msg”)

b) confirm()開啟確認對話方塊

i.window.confirm(“cfmMsg”);

c) prompt()開啟輸入對話方塊

i.window.prompt(“strShow”,”strInput”);

ii.strShow--輸入提示;strInput--輸入內容

iii.alert()、confirm()、prompt()屬於強制回應對話方塊,需要使用者進行相應處理

d) open()開啟一個新視窗

i.window.open(“url”,”winName”,”param[,param......]”);

ii.param用於描述開啟視窗的顯示效果;可賦有一到多個值;參數(toolbar、location、directions、status、menubar、scrollbars、resize、top、left、width、height)

e) blur()把焦點從指點視窗移開

f) Fouse()把指定的視窗移到前台

g) close()關閉視窗--winObj.close();

h) setTimeout()延時程式(定時器)

i.window.setTimeout(funName,millsec)

ii.兩個參數必須

iii.在指定時間間隔自動重複執行指定函數或程式碼片段(在millsec內重複執行funName方法)

iv.window.setInterval(funName,millsec);在指定時間間隔指定一次指定的函數或程式碼片段(間隔millsec時間執行一次funName方法)

i) clearTimeout()延時程式(定時器)終止

i.window..clearTimeout(timeId);

ii.timeId是使用者在定義setTimeout方法時指定的傳回值

iii.clearInterval()

JavaScript window對象

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.