There are two pages, A. jsp and B. jsp. A. jsp has a submit operation, and B. jsp is the action of the submit operation,
In. add <base target = "_ Self"> to the JSP page. On ie6.0,. the content of the JSP window is changed to B. JSP, and. JSP content addition will be overwritten, but a new window will pop up on ie7.0.
How can we avoid a new window after submitting a. jsp? What about a. jsp? Here are a few simple methods
I. implement it on the. jsp page
A. jsp
<form name="form1" method="post" target="submit2Here" action="B.jsp">//your html code</form><iframe name="submit2Here" style='display:none'></iframe>
In this way, the content of B. jsp will be put in the IFRAME named submit2here.
In Js of B. jsp,
You can use window. Parent to obtain the window of a. jsp;
You can use plain parent.doc ument to obtain the document of a. jsp;
Window. Parent. afunction () can be used to call the js method afunction defined in A. jsp;
In this way, you can use js to operate the elements and methods in A. jsp.
2. Use another page C. jsp
C.jsp
<iframe name="submitPage" src="A.jsp" width="900" height="630" frameborder="no" border="0" marginwidth="0" marginheight="0" allowtransparency="yes" ></iframe> <iframe name="submit2Here" style='display:none'></iframe>
A.jsp
<form name="form1" method="post" target="submit2Here" action="B.jsp">//your html code</form>
In this way, the content of B. jsp will be put in the IFRAME named submit2here in C. jsp.
In Js of B. jsp,
You can obtain the window of a. jsp by using upload parent.doc ument. Frames ['submitpage']. contentWindow;
You can use alert(paipaiparent.doc ument. Frames ['submitpage']. contentWindow. Name );
Or alert(registry.parent.doc ument. Frames [0]. contentWindow. Name); try
You can obtain the document of a. jsp using the optional parameter parent.document.frames['submitpage'{.content}w.doc ument;
Use callback parent.doc ument. Frames ['submitpage']. contentWindow. afunction () to call the js method afunction defined in A. jsp;
In this way, you can use js to operate the elements and methods in A. jsp.
Use the contentWindow attribute, which is compatible with browsers such as IE and Firefox.