<script language="javascript" src="./example/jquery.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
//给td添加click事件
alert("wwwwwwwww");
var tdNods = $("td");
tdNods.click(tdClick);});function tdClick()
{
//得到当前节点对象
var textNode = $(this);
//1 得到原来的值
var textValue = textNode.text();
//alert(textValue);
//2 创建 input控件
var input = $("<input>");
// 2.5 设置input的属性
input.attr("value",textValue);
input.attr("size",4);
//3 设置textNode的html内容
textNode.html(input);
//4 取消td的click事件
textNode.unbind("click");
// 5 让所有的文本内容被选中
input.select();
//6 键盘事件
input.keyup(function(event){
//6.5 根据各个浏览器来获得不同是键盘事件
var myEvent = event || window.event;
// 获得键盘Code
var keyCode = myEvent.keyCode;
//7 判断按下的是不是回车
if(keyCode == 13)
{
//8 把当前input框的内容获得
var inputNode = $(this);
var inputValue = inputNode.val();
//alert(inputValue);
//设置textNode的html为 inputValue
textNode.html(inputValue);
}
//判断按下的是不是ESC
if(keyCode == 27)
{
//设置成原来的text
textNode.html(textValue);
}
}); //判断input是否失去焦点
input.blur(function(){
var inputNode = $(this);
var inputValue = inputNode.val();
//alert(inputValue);
//设置textNode的html为 inputValue
textNode.html(inputValue);
});
//再次调用
textNode.click(tdClick);
}
</script>
此为编辑表单可编辑的代码
<script language="javascript" type="text/javascript">
$(document).ready(function(){
//给td添加click事件
alert("wwwwwwwww");
var tdNods = $("td");
tdNods.click(tdClick);});function tdClick()
{
//得到当前节点对象
var textNode = $(this);
//1 得到原来的值
var textValue = textNode.text();
//alert(textValue);
//2 创建 input控件
var input = $("<input>");
// 2.5 设置input的属性
input.attr("value",textValue);
input.attr("size",4);
//3 设置textNode的html内容
textNode.html(input);
//4 取消td的click事件
textNode.unbind("click");
// 5 让所有的文本内容被选中
input.select();
//6 键盘事件
input.keyup(function(event){
//6.5 根据各个浏览器来获得不同是键盘事件
var myEvent = event || window.event;
// 获得键盘Code
var keyCode = myEvent.keyCode;
//7 判断按下的是不是回车
if(keyCode == 13)
{
//8 把当前input框的内容获得
var inputNode = $(this);
var inputValue = inputNode.val();
//alert(inputValue);
//设置textNode的html为 inputValue
textNode.html(inputValue);
}
//判断按下的是不是ESC
if(keyCode == 27)
{
//设置成原来的text
textNode.html(textValue);
}
}); //判断input是否失去焦点
input.blur(function(){
var inputNode = $(this);
var inputValue = inputNode.val();
//alert(inputValue);
//设置textNode的html为 inputValue
textNode.html(inputValue);
});
//再次调用
textNode.click(tdClick);
}
</script>
此为编辑表单可编辑的代码
<tr style="background: url(./images/right_bgbj01.gif) repeat-x;"
height="27">
<td width="4%" align="center" >
<strong>种类</strong>
</td>
<td width="4%" align="center">
<strong>任务号</strong>
</td>
<td width="4%" align="center">
<strong>工装号</strong>
</td>
<td width="4%" align="center">
<strong>型别</strong>
</td>
</thead>
<tbody>
<logic:notEmpty name="rwresultList">
<logic:iterate id="list" name="rwresultList">
<tr>
<td>
<bean:write name="list" property="kind" />
</td>
<td>
<bean:write name="list" property="id.rwh" />
</td>
<td>
<bean:write name="list" property="id.gzh" />
</td>
<td>
<bean:write name="list" property="xb" />
</td>
</tr>
</logic:iterate>
</logic:notEmpty> </tbody>这个是表单内容 我现在上面的编辑表单只能编辑表头名称,而我想可编辑查询出来的表体内容,该如何修改呢?