当我点击它时,该按钮没有被禁用,这里有我的代码:
<script type="text/javascript">
function SetNewsCommentReportFlag(newsCommentId) {
$("#news-comment" + newsCommentId).text("This comment has been removed");
$("#post-button" + newsCommentId).attr("onclick", "this.disabled=true;");
var jqxhr = $.getJSON("<%=
Url.Action(
"SetNewsCommentReportFlag",
"Home",
new { area = "News" }
)
%>?newsCommentId=" + newsCommentId, function (data) { });
}
</script>
<div class="news-comment" id="news-comment<%: Model.NewsCommentId %>">
<% if (Model.Reported)
{
Model.NewsComment = "This comment has been removed";
} else %>
<%: Model.NewsComment %>
</div>
<div class="clear"></div>
<div class="actions-right">
<a href="javascript:SetNewsCommentReportFlag(<%: Model.NewsCommentId %>);"
class="button" id="post_button<%: Model.NewsCommentId %>"
><%: Html.Resource(Resources.Global.Button.Report) %></a>
</div>
像这样?:
<script type="text/javascript">
function SetNewsCommentReportFlag(newsCommentId) {
$("#news-comment" + newsCommentId).text("This comment has been removed");
$("#post-button" + newsCommentId).attr("onclick", "this.disabled=true;");
var jqxhr = $.getJSON(
"/News/Home/SetNewsCommentReportFlag?newsCommentId="
+ newsCommentId, function (data) { }
);
}
</script>
<div class="news-post-list-item">
<div class="news-post-user-info-wrapper">
<div class="avatar">
<img src="/ThemeFiles/Base/images/User/user-avatar.png"
width="52" height="52" alt="Avatar" />
</div>
<div class="who-and-when-box">
25/02/2013 13:20:56
<br />
<br />
Cecilia Torres Castro
</div>
<div class="news-comment" id="news-comment3">
sdfsdf
</div>
<div class="clear"></div>
<div class="actions-right">
<a href="javascript:SetNewsCommentReportFlag(3);"
class="button" id="post_button3">Report</a>
</div>
</div>
<div class="clear"></div>
</div>
请问我做错了什么?谢谢