1) design an outermost page. jsp contains a. js
A. js uses window. top to retrieve the top-navigation page window;
The advantage is that if. in jsp, The ifram N-layer page, the N-layer page only needs to call. jsp window. top. parent. parent .......
2) The second method is as follows:
Define a <div id = 'myflag'> </div> in a. jsp.
The following functions are defined in a. js:
Function getWindow (){
Var obj = window. self;
While (true)
{
If(obj.doc ument. getElementById ("myFlag "))
{
Return obj;
}
Obj = obj. window. parent;
}
}
The first method is to use window. top,
The second method actually uses the parent. parent... method to obtain the above... level mark and then return the object.
The two methods seem to be the first one, which is labor-saving and convenient, but when two page fusion scenarios occur, that is, B. jsp iframe. when jsp occurs,. js window. top is invalid. You can only use the second method.