Use the dohandler method of ymprompt to obtain the subwindow return value.

Source: Internet
Author: User
Today, the ymprompt win method is used to pop up a window. Because we need to use the value returned from the subwindow to determine whether to refresh the parent window, we have not found a proper method in the ymprompt component demo. I am very depressed and still don't have to worry about it, I checked the introduced method from the beginning to the end, and saw two parameters sign and autoclose in dohandler. After reading the method introduction, I thought this method was feasible (previously I used ymprompt. Close method to close the subwindow directly ), And write a script to test it. Code Post as follows:

Parent window code:

Function viewsubfeedetail (feeid)
{
Ymprompt. Win ({message: 'viewsubfeedetail. Action? Feeid = '+ feeid, Handler: callback, width: 800, height: 400, Title: 'tariff details information', IFRAME: true })
}

Function callback (TP)
{
Alert (TP );
}

 

Subwindow code:

Function closewin ()
{
Window. Parent. ymprompt. dohandler ('error', true );
}

In this way, when the subwindow button triggers closewin, the "error" value is returned to the TP parameter of the callback function of the parent window. The true parameter is to automatically close the subwindow.

 

Appendix: ymprompt-related materials

Demo address: http://www.ajaxbbs.net/test/ymPrompt4.0/demo.html

Introduction and: http://www.ajaxbbs.net/post/product/ymPrompt4.0.html

Website: http://www.ajaxbbs.net/

Today, the ymprompt win method is used to pop up a window. Because we need to use the value returned from the subwindow to determine whether to refresh the parent window, we have not found a proper method in the ymprompt component demo. I am very depressed and still don't have to worry about it, I checked the introduced method from the beginning to the end, and saw two parameters sign and autoclose in dohandler. After reading the method introduction, I thought this method was feasible (previously I used ymprompt. Close method to close the subwindow directly ), Write a script for testing, and you can implement what I want. The code is now pasted as follows:

Parent window code:

Function viewsubfeedetail (feeid)
{
Ymprompt. Win ({message: 'viewsubfeedetail. Action? Feeid = '+ feeid, Handler: callback, width: 800, height: 400, Title: 'tariff details information', IFRAME: true })
}

Function callback (TP)
{
Alert (TP );
}

 

Subwindow code:

Function closewin ()
{
Window. Parent. ymprompt. dohandler ('error', true );
}

In this way, when the subwindow button triggers closewin, the "error" value is returned to the TP parameter of the callback function of the parent window. The true parameter is to automatically close the subwindow.

 

Appendix: ymprompt-related materials

Demo address: http://www.ajaxbbs.net/test/ymPrompt4.0/demo.html

Introduction and: http://www.ajaxbbs.net/post/product/ymPrompt4.0.html

Website: http://www.ajaxbbs.net/

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.