如何获得jsp动态生成的div的值(急)
<%
List list = (List)request.getAttribute("listTypes");
for(int i=0;list!=null&&i<list.size();i++){
Type type = (Type)list.get(i);
%>
<tr>
<td height="20" bgcolor="#FFFFFF" class="STYLE19">
<div align="center" id="typeName|<%=type.getTypeId()%>" ondblclick="toReplace(this);"><%=type.getTypeName()%></div>
</td>
<td height="20" bgcolor="#FFFFFF" class="STYLE19">
<div align="center" id="typeDesc|<%=type.getTypeId()%>" ondblclick="toReplace(this);"><%=type.getTypeDes() %></div>
</td>
<td height="20" bgcolor="#FFFFFF">
<div align="center">
<span class="STYLE21"><a
href="addType.jsp?typeId=<%=type.getTypeId()%>">修改</a>|<a
href="typeAction!delete?typeId=<%=type.getTypeId()%>">删除</a> </span>
</div>
</td>
</tr>
<%
}
%>
toReplace = function(divElement) {
// 创建一个input元素
var inputElement = document.createElement("input");
// 把obj里面的元素以及文本内容赋值给新建的inputElement
inputElement.value = divElement.innerHTML;
// 用新建的inputElement代替原来的oldDivElement元素
divElement.parentNode.replaceChild(inputElement, divElement);
// 当inputElement失去焦点时触发下面函数,使得input变成div
inputElement.onblur = function() {
//把input的值交给原来的div
divElement.innerHTML = inputElement.value;
//用原来的div重新替换inputElement
inputElement.parentNode.replaceChild(divElement, inputElement);
var divValue = divElement.id;
//获取divValue的数字和字母组成的数组
var arr = divValue.split("|");
//获取div中的数字
var num = arr[1];
//获取div中的字母
var str = arr[0];
alert(num);
//记录种类名称
var typeName;
//种类简介
var typeDesc;
//种类信息
if(divElement.id ==("typeName|" + num)){
typeName = divElement.innerHTML;
typeDesc = $("#typeDesc|" + num).val();
}else if(divElement.id = ("typeDesc|"+num)){
typeDesc = divElement.innerHTML;
typeName = $("#typeName|"+num).val();
}
alert("name = " + typeName);
alert("desc = " + typeDesc);
$.ajax({
type: "POST",
url: "typeAction!update",
data: "typeId="+num+"&typeName="+typeName+"&typeDesc="+typeDesc+"&checkId="+num,
success: function(msg){ ; }
});
}
}