Click here to Skip to main content
15,914,397 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my ASP.Net project, I use
C#
var linkPopup2 = (HtmlInputButton)e.Row.FindControl("lnkPopup2");
linkPopup2.Attributes.Add("onmouseover", "ShowPage('" + sName + "','" + sPhotoPath + "')");
linkPopup2.Attributes.Add("onmouseout", "ClosePage()");

that call 2 JavaScript functions, respectively, as shown below:
C#
function ShowPage(name, url) {
            window.showModalDialog(url + '?name=' + name, window,
'dialogHeight:500px;dialogWidth:650px;center:yes;help:no;resizable:no;status:no');
        }

        function ClosePage() {
            window.close();
        }


The ShowPage() works fine but the ClosePage() does not. How can this opened window be closed? Thanks.
Posted
Comments
Timberbird 29-Oct-13 9:18am    
What are you trying to achieve? According to your code on onmouseover() you open a new window and on onmouseout() you close the current window - i.e. not the one opened as popup but the one which contains the link.
If that's what you are trying to achieve, then your code should work in all browsers except Firefox (which doesn't allow to close pages not opened by the current one). But if your purpose is to close popup window on mouse out event, please see example from this link

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900