JQueryを使用してモデルのポップアップを開いたり閉じたりしています。JQueryを使用してButtonのClickイベントで2つのモデルポップアップを閉じて開きます
//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();
$('mb_overlay_Popup').setStyle('z-index','1600');
});
}
クローズ機能は、ポップアップウィンドウの[キャンセル]ボタンで使用すると問題なく動作します。
しかし、私は開かれたポップアップウィンドウを閉じて、同じリンクボタンを使用して、その後新しいポップアップを開きたい、そしてこのために、私は以下のようにaspx.csページのPage_Loadので試してみました:
lnkButton.Attribues.Add("onClick","UserSignUpClose();");
lnkButton.Attribues["onClick"]+="UserSignupModalpopupFromSubDomain(location.href,document.title);";
をしかし、それは動作していません 私は取得しようとすると、そのidを使用して、私はIDと型とinnerHTMLのようなプロパティを取得できませんでした。
事前に感謝します。あなたは要素のIDなどiframe-signup
、mb_Error_Popup
とmb_Title_Popup
を割り当てているが、あなたは要素をslectする$('iframe-signup').src = srcFile;
を使用している