用Javascript模仿DataGrid
<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>
- 上一篇: JavaScript写自定义对象语法
- 下一篇: 网页中图片和文字相分离的方法