Home > Web Front-end > JS Tutorial > body text

ymPrompt's doHandler method to implement the method of obtaining the return value of the child window_javascript skills

WBOY
Release: 2016-05-16 18:24:24
Original
1204 people have browsed it

I was very depressed and still didn’t give up. I read the introduced method from beginning to end. When I saw doHandler, there were two parameters sign and autoClose. After reading the method introduction, I felt that this method was feasible (I had always used it before). ymPrompt.close method to directly close the child window), I wrote a script to test it, and it can achieve what I want. I will post the code as follows:
Parent window code:

Copy code The code is as follows:

function viewSubFeeDetail(feeId)
{
ymPrompt.win({message:'viewSubFeeDetail. action?feeId=' feeId,handler:callBack,width:800,height:400,title:'Fee details',iframe:true})
}
function callBack(tp)
{
alert(tp);
}

Sub window code:
Copy code Code As follows:

function closeWin()
{
window.parent.ymPrompt.doHandler('error',true);
}

In this way, when the button of the child window triggers closeWin, the "error" value is passed back to the parameter tp of the callback function of the parent window. The true parameter is to automatically close the child window.
Attachment: ymPrompt download
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template