Javascript analysis on the problem of refreshing the parent page after executing the open. window subpage _ javascript skills

Source: Internet
Author: User
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 ("

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.