0
在其他的事情,我有我的內容頁面這個網站的內容:jQuery的問題與錨點擊()方法
<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
$("[ID$=panelDetail]").dialog({
autoOpen: false
, resizable: false
, height: 'auto'
, width: 'auto'
, modal: true
, overlay: { opacity: 0.8, background: "black" }
});
function loadDialog(action) {
$("[ID$=panelDetail]").dialog('open');
$.ajax({
type: "POST",
dataType: "HTML",
url: action,
data: {},
success: function(response) {
$("#panelDetail").html('');
$("#panelDetail").html(response);
}
});
}
$("[ID$=btnAdd]").click(function() {
alert("click on add");
loadDialog("/Foro/Create", "");
});
</script>
</asp:Content>
我有那麼兩個分開的部分
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent" runat="server">
<div id="panelDetail" style="display:none" title="Panel Title"></div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="RightPanel" runat="server">
<a href="#" id="btnAdd">Add new</a>
<a href="#" id="btnEdit">Edit</a>
</asp:Content>
爲什麼這個HTML片段標記內部的警報永遠不會被調用?
感謝您的幫助!
你說得對。我現在覺得很蠢。謝謝!好奇心:「$(function(){})」是「$(document).ready(function(){})」的縮寫嗎? – Lorenzo 2010-09-07 13:50:07
@Lorenzo - 活着學習,只要你沒有活過它*學習它之後你就會做得很好:) – 2010-09-07 13:53:16
@Lorenzo - 是的,這是正確的,它們是可以互換的,我只是在它上面輸入很多次一天,所以我個人更喜歡短版。 – 2010-09-07 13:53:50