JavaScript analysis of the problem of refreshing the parent page after the Open.window child page has finished executing

Source: Internet
Author: User

This article mainly introduced JavaScript about the implementation of Open.window page after the completion of the parent page refresh problem, example analysis of JavaScript operation of the implementation of the child page and the parent page refresh skills, very practical value, the need for friends can refer to the

The example of this article analyzes JavaScript's method of refreshing the parent page after the execution of the Open.window child page. Share to everyone for your reference. The specific analysis is as follows:

Main Page:

?

1 <input id= "btnadd" type= button "onclick=" Openwin (); "value=" Add "/>"

The following code is available in JS:

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14-15 16 function Openwin () {window.open (' addinfo.jsp ', ' _blank ', ' width=300,height=400,top=200,left=400 ');}//define callback method, Used to callback function callback () {Refreshwin ();}//Refresh the current page function Refreshwin () {//Call the method to refresh the page, here Refreshsocket the method for refreshing the page//that is to say, If the page has a refresh button,//Click the button to submit the class name is here the class name var url = ' Refreshsocket '; window.location.href = URL; }

The following code is available on the addinfo.jsp page:

?

1 2 3 <form name= "form" action= "Addsocket" method= "get" > <input id= "onsub" "type=" button "onclick=" Formsubmit (); " Value= "OK" > </form>

?

1 2 3 4 5 6 7 8 function Formsubmit () {this.form.submit ();////Submit action to Addsocket class Window.opener.callback ();//After completion of the above execution, Call the callback method that opens the page,//Here is the callback method Window.close () that calls the home page ();//The current page closes}

In addition, if it is like deleting such an operation, jump directly 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 write the jump statement directly in the class, as follows:

Main Page mainpage.jsp:

?

1 2 Delete Operation Association background of the Deletesocket class, if you want to pass the parameters, with the? window.location.href = Deletesocket

Deletesocket class Page:

Copy code code as follows:

After performing a series of actions, you can write JavaScript code directly

After you have written this sentence, you can jump directly to the main page and refresh the main face.

Out.print ("");

I hope this article will help you with your JavaScript programming.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.