87,910
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试</title>
<script language="JavaScript">
function Edit(sender,id)
{
if(!sender.lastChild || sender.lastChild.tagName != "TEXTAREA"){
var box = document.createElement("textarea");
box.style.cssText = "background-color:transparent;border:none; font:14px 宋体;margin:-2pt -1pt;width:100%; overflow:hidden";
box.rows = 1;
if(sender.align) box.style.textAlign = sender.align;
box.defaultValue = box.value = document.getElementById(id).value;//sender.innerText;
sender.innerHTML = "";
sender.appendChild(box);
box.onpropertychange = function(){
if(this.value) this.style.posHeight = this.scrollHeight;
}
box.onblur = function(){
if(this.value == this.defaultValue){
sender.innerText = this.value;
sender.bgColor = "";
}
}
box.focus();
sender.bgColor = "#effbff";
}
}
</script>
</head>
<body>
<input name="aa1" id="aa1" type="hidden" value="gggg" />
<input name="aa2" id="aa2" type="hidden" value="hello" />
<input name="aa3" id="aa3" type="hidden" value="hi" />
<table width="200" border="1">
<tr>
<td onclick="Edit(this,'aa1')"> </td>
<td onclick="Edit(this,'aa2')"> </td>
<td onclick="Edit(this,'aa3')"> </td>
</tr>
</table>
</body>
</html>