Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a div tag and with the help of iframe i am showing a webform in the div tag as a popup. In my project i am using master pages. I have a problem when i am closing the pop up the pop up is not closing. It stays as it is.

The code which i am using to show the popup is

function showPopup(o, u)
{
var obj = document.getElementById(o);
if (u)
{
obj.style.display = 'block';
window.open(u, o);
}
else
obj.style.display = 'none';

return false;
}

and the code to hide the pop up is

function hidePopup(p) {
this.document.getElementById(p).style.display = 'block';
}

can anyone tell me how i can close the popup.
Posted

1 solution

C#
//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;
var popupName = '';

//loading popup with jQuery magic!
function loadPopup(currentpopup) {
    //loads popup only if it is disabled
    $("#backgroundPopup").css({
        "opacity": "0.7"
    });
    //$("#backgroundPopup").fadeIn("slow");
    $("#backgroundPopup").fadeIn();
    $(currentpopup).css({"z-index": "2" });
    //$(currentpopup).fadeIn("slow");
   $(currentpopup).fadeIn();
}

//disabling popup with jQuery magic!
function disablePopup(currentpopup) {
    //disables popup only if it is enabled
    $(currentpopup).fadeOut("slow");
    //$("#backgroundPopup").fadeOut("slow");
    $("#backgroundPopup").fadeOut();

}

//centering popup
function centerPopup(currentpopup) {
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $(currentpopup).height();
    var popupWidth = $(currentpopup).width();
    //centering
    $(currentpopup).css({
        "position": "absolute",
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });
    //only need force for IE6

    $("#backgroundPopup").css({
        "height": windowHeight
    });
}





Link this jquery on your Master Page and Call these Functions on Ur Web Form
 
Share this answer
 

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