用JS模仿DataGrid

发表于:2007-06-30来源:作者:点击数: 标签:
HTML HEAD TITLE JS模仿的DataGrid/TITLE /HEAD SCRIPT LANGUAGE=" Java Script" !-- function ChangeValue(obj TD ) { var objName; objName = objTD.id; objTD.innerHTML = "input type=text id=txtBox name=textfield value="+objTD.innerText+" onBlur=W
 

<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>


原文转自:http://www.ltesting.net