javascript
  • jquery-ui
  • django-models
  • 2011-06-28 3 views 0 likes 
    0

    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-signupmb_Error_Popupmb_Title_Popupを割り当てているが、あなたは要素をslectする$('iframe-signup').src = srcFile;を使用している

    答えて

    0

    $('#iframe-signup').src = srcFile; // the # sign 
    

    はすべてのために同じことを次のようにIDを持つ要素を選択するためのjQueryの構文は次のとおりです。そのような選択

    関連する問題