日期:2012-09-19  浏览次数:20857 次

 

<HTML>
<HEAD>
<TITLE> JS模仿的DataGrid</TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ChangeValue(objTD)
{
 var objName;
 objName = objTD.id;
 objTD.innerHTML = "<input type=text id=txtBox name=textfield value="+objTD.innerText+" onBlur=WriteNewValue(this.value,"+objName+");>";
}
function WriteNewValue(strTxt,objTD)
{
 objTD.innerText = strTxt;
}//-->
</SCRIPT>


<BODY>
<TABLE width="500" align="center" cellpadding="1" cellspacing="1" bgcolor="#3333CC">
<TR bgcolor="#FFFFFF">
 <TD height="30" id="td1" onDblClick="ChangeValue(this);"><P>QQQQQQ</P></TD>
 <TD id="td2" onDblClick="ChangeValue(this);">fdsafas</TD>
 <TD id="td3" onDblClick="ChangeValue(this);">fadsfasf</TD>
 <TD id="td4" onDblClick="ChangeValue(this);">fsdafasf</TD>
 <TD id="td5" onDblClick="ChangeValue(this);">fdsaf</TD>
</TR>
</TABLE>
</BODY>
</HTML>