This article mainly introduces javascript about open. window subpage refresh the parent page after the execution is complete. The example analyzes the execution of the javascript operation subpage and the refresh technique of the parent page, which is very useful, if you need it, you can refer to the examples in this article to analyze the javascript open. the method to refresh the parent page after the window sub-page is executed. Share it with you for your reference. The specific analysis is as follows:
Home page:
The following code is available in js:
Function openWin () {window. open ('addinfo. jsp ',' _ blank ', 'width = 300, height = 400, top = 200, left = 400');} // defines the callback method for callback function callback () {refreshWin () ;}// refresh the current page function refreshWin () {// call the method for refreshing the page. here, RefreshSocket is the method for refreshing the page. // that is to say, if the page has a refresh button, // the class name submitted by clicking the button is the class name var url = 'refreshsocket '; window. location. href = url ;}
The addInfo. jsp page contains the following code:
Function formSubmit () {this. form. submit (); // submit the action to the AddSocket class window. opener. callback (); // after the preceding execution is complete, call the callback method to open the page. // call the callback method window on the home page. close (); // close the current page}
In addition, if you want to delete an operation like this, you can directly jump from a jsp to a class. after performing a series of operations in the class, if you want to refresh the current page, you can directly write jump statements in the class, as shown below:
MainPage. jsp on the home page:
// The delete operation is associated with the DeleteSocket class in the background. if you want to transmit parameters, use? Window. location. href = DeleteSocket
DeleteSocket page:
The code is as follows:
// After performing a series of operations, you can directly write JavaScript code
// After writing this sentence, you can directly jump to the home page and refresh the home page
Out. print ("