2013-02-25 23 views
0

這是我的代碼,爲什麼不與img鏈接密切合作?鏈接是id =「closeme」。它根本不開火。關閉jQuery UI DIALK鏈接ID

function displayerror(text){   
// Pop up the new error dialog 
     var $errors_dialog = $('<div></div>') 
     .html('<div class="notice_body"><div class="notice_header"><img src="images/header.gif" width="634" height="37"></div><div class="notice_mid"><div class="notice_left"><img src="images/body_left.gif" width="164" height="167"></div><div class="notice_right">'+text+'</div></div><div class="notice_footer"><a href="#" id="closeme"><img src="images/footer.gif" width="634" height="49"></a></div></div>') 
     $errors_dialog.dialog({ 
      autoOpen: false, 
      maxWidth:670, 
        maxHeight: 260, 
         width: 670, 
         modal: true , 
         height: 500, 
         resizable: false, 
         dialogClass:'transparent', 
         position: ['top', 175], 
         create: function(event, ui) { 
         $("#closeme").click(function(event) { 
         alert("test"); 
          $errors_dialog.dialog('close'); 
       })} 
     }); 

     $errors_dialog.dialog('open'); 
     return false; 

}

回答

0

只是公開聲明之前,由此實現它:

 $("#closeme").click(function(){ 
      $errors_dialog.dialog('close'); 
     });