JavaScript questions about refreshing the parent page after Open.window child page execution _javascript tips

Source: Internet
Author: User

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:

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

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 ();
}
Refreshes the current page
function Refreshwin () {
//calls the Refresh page method, where Refreshsocket the corresponding method for refreshing the page
//That is, if the page has a refresh button,
/ Then 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:

<form name= "form" action= "Addsocket" method= "get" > <input id= "onsub" button "type=" onclick=
(); "Value= OK" >
</form>
function Formsubmit () {
this.form.submit ();
Submit action to Addsocket class
window.opener.callback ();
When the above execution is complete, call the callback method that opens the page,
//Here is the callback method Window.close () that calls the master 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:

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 ("<script type= ' text/javascript ' >location.href= ' mainpage.jsp ' </script>");

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

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.