2009年2月9日 星期一

javascript memo(2) scripting browser window

14.2.2 loading new document

下面這句話 測不出來
In most cases, document.location is the same as location.href. When there is a server redirect, however, document.location contains the URL as loaded, and location.href contains the URL as originally requested.


14.2.3 The History Object
Netscape and Mozilla-based browsers also support back( ) and forward( ) methods on the Window object itself. These nonportable methods perform the same action as the browser's Back and Forward buttons. When frames are used, window.back( ) may perform a different action than history.back( ).



open 可以設定參數, open 會傳回代表開啟的 window object, opener 則是代表開啟被開啟視窗的window object, 如果視窗不是由javascript 開啟, 是由user 開啟, opener 屬性就會是 null

window.close, 一般而言只能關閉由妳javascript 產生的 window, 由user 產生的會丟出confirm box

window object 會在其代表視窗關掉之後依然存在, 所以有時有必要check close attribute 來確認視窗是否已經關閉
window.closed




function 是在其所定義的地方執行, 不是在被呼叫的地方, 所以妳如果呼叫的是上層的function
那該function 其所在的document 或是 window 當然也是上層的, 所以如果要用某些function 取用自己的window, document 還是要自己include 該 function

沒有留言: