I am using a JQuery to open and close a model pop-up.
//Function to open pop-up
function UserSignupModalpopupFromSubDomain(guid,title)
{
var srcFile = "../ModelPopup/SignUpPopup.aspx";
if (guid) srcFile += '?location=' + guid+'&title=' + title; /* sample code to append a unique user ID to page called */
var cFrame = new Element('iframe').setProperties({id:"iframe-signup", name:"iframe-signup", height:'420px', width:'584px', frameborder:"0", scrolling:"no"}).injectInside(document.body);
$('iframe-signup').src = srcFile;
customModalBox.htmlBox('iframe-signup', '', 'Sign up');
$('mb_contents_Popup').addClass('yt-Panel-Primary_Popup');
new Element('div').setHTML(' ').setProperty('id','mb_Error_Popup').injectTop($('mb_center_Popup'));
new Element('h2').setHTML('Sign UP').setProperty('id','mb_Title_Popup').injectTop($('mb_contents_Popup'));
// $('mb_center').setStyle('z-index','2005');
// $('mb_overlay').setStyle('z-index','2004');
$('mb_center_Popup').setStyle('z-index','2005');
$('mb_overlay_Popup').setStyle('z-index','2004');
}
// pop-up close function
function UserSignUpClose() {
$('mb_close_link').addEvent('click', function() {
//if($('yt-UserProfileContent1')) $('yt-UserProfileContent1').remove();
if($('iframe-signup')) $('iframe-signup').remove();
if($('mb_Title_Popup')) $('mb_Title').remove();
if($('mb_contents_Popup')) $('mb_contents_Popup').removeClass('yt-Panel-Primary_Popup');
if($('mb_Error_Popup')) $('mb_Error_Popup').remove(开发者_Python百科);
$('mb_overlay_Popup').setStyle('z-index','1600');
});
}
the close function is working fine when we use it with "Cancel" button of the pop-up window.
But i want to close a opened pop-up window and open a new pop-up subsequently using same link button, and for this i tried as below at Page_load of aspx.cs page :
lnkButton.Attribues.Add("onClick","UserSignUpClose();");
lnkButton.Attribues["onClick"]+="UserSignupModalpopupFromSubDomain(location.href,document.title);";
but its not working While i tried to get and using its ids, i couldn't get its properties like id and type and innerHTML.
prior thanks.
you are assigning iframe-signup
, mb_Error_Popup
and mb_Title_Popup
as ids of the elements but you are using $('iframe-signup').src = srcFile;
to slect the elements
The jQuery syntax for selecting elements with ids is as follows
$('#iframe-signup').src = srcFile; // the # sign
do the same for all such selections
精彩评论