YmPrompt doHandler method to obtain the return value of a subwindow _ javascript Technique

Source: Internet
Author: User
Today, the ymPrompt win method is used to pop up a window. Because it is necessary to use the value returned from the subwindow to determine whether to refresh the parent window, the ymPrompt component Demo has not found a proper method to achieve this, so I am still not worried, 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, you can achieve what I want, and now paste the Code as follows:
Parent window code:

The Code is as follows:


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:

The Code is as follows:


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.
Attachment: ymPrompt download
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.