[img]http://dl.iteye.com/upload/attachment/0070/2651/d7241d59-b118-37ba-99b9-9d0020e64a67.jpeg[/img]
当<a οnclick="[color=red]editContent [/color]">编辑 </a> 设定的id为editContent,此时点击编辑,不管是1还是2处编辑,只能编辑第一条数据。因为系统不知道需要操作那条数据,所以为把每条数据的id放在input的id里,这样就可以区分哪个input啦
正确如下:
<s:iterator status="index">
<div class="messageInfo ui-widget-border-on ui-widget-border">
<div class="grid_24 heightAuto">
<div class="grid_6 heightAuto"><span class="accordred"><s:property value="dealDescription"/></span><s:if test="content != null && !content.equals('')"> 并留言: <a οnclick="[color=red]editContent(${id}) [/color]">编辑 </a> [url=#]保存[/url]</s:if></div>
</div>
<div class="grid_24 heightAuto">
<input id="contentStyle${id}" value="${content}" class="grid_24 heightAuto" disabled="disabled"/>
</div>
</div>
</s:iterator>
function editContent(id){
[color=red]$("#contentStyle"+id).[/color]attr("disabled","");
}
function setContentDisabled(id){
$("#contentStyle"+id).attr("disabled","disabled");
}
function saveContent(id){
if($("#contentStyle"+id).attr("disabled")==true){
return;
}
var content = $("#contentStyle"+id).val();
$.ajax({
url:"${path }/issue/issueManage/updateContent.action?content="+content+"&id="+id,
success:function(data){
$.messageBox({message:"批示内容已经成功修改!"});
setContentDisabled(id);
}
});
}
当<a οnclick="[color=red]editContent [/color]">编辑 </a> 设定的id为editContent,此时点击编辑,不管是1还是2处编辑,只能编辑第一条数据。因为系统不知道需要操作那条数据,所以为把每条数据的id放在input的id里,这样就可以区分哪个input啦
正确如下:
<s:iterator status="index">
<div class="messageInfo ui-widget-border-on ui-widget-border">
<div class="grid_24 heightAuto">
<div class="grid_6 heightAuto"><span class="accordred"><s:property value="dealDescription"/></span><s:if test="content != null && !content.equals('')"> 并留言: <a οnclick="[color=red]editContent(${id}) [/color]">编辑 </a> [url=#]保存[/url]</s:if></div>
</div>
<div class="grid_24 heightAuto">
<input id="contentStyle${id}" value="${content}" class="grid_24 heightAuto" disabled="disabled"/>
</div>
</div>
</s:iterator>
function editContent(id){
[color=red]$("#contentStyle"+id).[/color]attr("disabled","");
}
function setContentDisabled(id){
$("#contentStyle"+id).attr("disabled","disabled");
}
function saveContent(id){
if($("#contentStyle"+id).attr("disabled")==true){
return;
}
var content = $("#contentStyle"+id).val();
$.ajax({
url:"${path }/issue/issueManage/updateContent.action?content="+content+"&id="+id,
success:function(data){
$.messageBox({message:"批示内容已经成功修改!"});
setContentDisabled(id);
}
});
}