单元格双击实现输入并高亮显示的表格_层和布局特效

模板酷站

      JavaScript控制单元格双击实现输入,并在输入状态高亮显示单元格,这是前台的一个实现,如果要真正实现双击编辑那可能需要ASP或PHP配合提交数据,研究一下。


      <html> <head> <meta http-equiv="Content-Type" mrc="text/html; charset=gb2312" /> <title>输入时高亮的Excel表格</title> <script language="javascript" type="text/javascript"> function hilite(o){ o = document.getElementById("td"+o.name.toString()); o.style.border ='2px solid #007EFF';//变色 } function delite(obj){ obj = document.getElementById("td"+obj.name.toString()); obj.style.border ='';//恢复边框 } </script> </head> <body> <table width="222" border="1" cellpadding="0" cellspacing="0"> <tr> <td id="td_1"><input id="_1" name="_1" onblur="delite(this);" onfocus="hilite(this);"/></td> <td id="td_2"><input id="_2" name="_2" onblur="delite(this);" onfocus="hilite(this);"/></td> <td id="td_3"><input id="_3" name="_3" onblur="delite(this);" onfocus="hilite(this);"/></td> </tr> </table> </body> </html>