前端之家收集整理的这篇文章主要介绍了
双击修改,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
public String upname(){
int result=0;
System.out.println("upname
方法+++++");
HttpServletResponse response=ServletActionContext.getResponse();
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
response.setHeader("Cache-Control","no-cache");
try {
PrintWriter out=response.getWriter();
String name=new String(p_name.getBytes("ISO8859_1"),"UTF-8");
TPart part = service.getOne(p_id);
part.setPName(name);
System.out.println("测试双击
修改");
this.service.updatePname(part);
System.out.println("sasa");
out.println(result);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
var xmlhttp;
var lastvalue;
var myidtype;
var myid;
function getIE(){
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
//变文本框
function getqiwu(id,idtype,obj){
myidtype=idtype;
myid=id;
document.getElementById(idtype).outerHTML="<input type=text id='"+idtype+"' value='"+obj+"' onblur=changeObj('"+id+"',this,'"+idtype+"');>";
document.getElementById(idtype).focus();
}
function changeObj(id,obj,type){
//判断IE
getIE();
lastvalue=obj.value;
var lastname=type.substring(type.length-1,type.length);
var url="";
if(lastname=='n'){
url="${pageContext.request.contextPath}/part_upname.action?p_id="+id+"&p_name="+obj.value;
}else{
url="${pageContext.request.contextPath}/part_upremark.action?p_id="+id+"&p_remark="+obj.value;
}
var str=encodeURI(url);
xmlhttp.open("GET",str,true);
xmlhttp.onreadystatechange=getBack;
xmlhttp.send();
}
//回滚
@H_403_161@
function getBack(){
document.getElementById(myidtype).outerHTML="<span id="+myidtype+" ondblclick=getqiwu("+myid+",'"+myidtype+"','"+lastvalue+"');>"+lastvalue+"";
<span id="${x.PId}n" ondblclick="getqiwu(${x.PId},'${x.PId}n','${x.PName}');">
<SPAN id="${x.PId}s" ondblclick="getqiwu(${x.PId},'${x.PId}s','${x.PRemark}');">