mail.163.com顺便,我也把我自己做的一点简单的表格程序贡献出来,大家共享,也许有点用,大家讨论一下,看是否还有更好的办法:<TABLE BORDER="1" id=tbl style="border-collapse:collapse" cellspacing=0 cellpadding=0 borderColor='black'>
    <COL STYLE="color:red" id=col1 >
    <COL STYLE="color:blue" id=col2>
    <COL STYLE="color:green" id=col3>
    <TR onmouseover="this.style.backgroundColor='#cceedd'" onmouseout="this.style.backgroundColor=''">
        <TD onclick="col1.style.color=(col1.style.color=='red')?'orange':'red'" onmouseover="this.style.cursor='hand'">此列位于第一组。</TD>
        <TD onclick="col2.style.color=(col2.style.color=='blue')?'orange':'blue'" onmouseover="this.style.cursor='hand'">此列位于第二组。</TD>
        <TD onclick="col3.style.color=(col3.style.color=='green')?'orange':'green'" onmouseover="this.style.cursor='hand'">此列位于第三组。</TD>
    </TR>
    <TR onmouseover="this.style.backgroundColor='#ccddff'" onmouseout="this.style.backgroundColor=''">
        <TD>此列位于第一组。</TD>
        <TD>此列位于第二组。</TD>
        <TD>此列位于第三组。</TD>
    </TR>
     <TR onmouseover="this.style.backgroundColor='#dddddd'" onmouseout="this.style.backgroundColor=''">
        <TD>此列位于第一组。</TD>
         <TD>此列位于第二组。</TD>
        <TD>此列位于第三组。</TD>
    </TR></TABLE>
<button onclick="alert(tbl.rows(0).cells(tbl.rows(0).cells.length-1).onclick);">test</button>
<button onclick="col1.width='150px'">test</button>
<button id="btn1">添加行</button><button id="btn2">添加列</button>
<SCRIPT LANGUAGE=javascript>
<!--
var A=new Array('cc0099','99cc00','cc9966','cccc00','99ff99','99ff66','ff3399','cc6699','ff33ff','cc99cc','ffcc66');function btn1.onclick(){
tbl.lastChild.appendChild(tbl.rows(tbl.rows.length-1).cloneNode(true));
}function btn2.onclick(){
var coln=tbl.firstChild.firstChild.cloneNode(true);
coln.id='col'+(document.getElementsByTagName("COL").length+1);
var t="#"+A[document.getElementsByTagName("COL").length-3]
coln.style.color=t;
tbl.firstChild.appendChild(coln);
var newID=eval('col'+(document.getElementsByTagName("COL").length));
 
 for(i=0;i<tbl.rows.length;i++){
newCell=tbl.rows(i).cells(0).cloneNode(true);
newCell.innerText="这是新添加的列";
if(i==0)newCell.onclick=function(){newID.style.color=newID.style.color==t?'orange':t}
tbl.rows(i).appendChild(newCell);

  }}//-->
</SCRIPT>

解决方案 »

  1.   

    sorry,请问一下,这个事件怎么实现:鼠标移到表格边框上是怎么捕捉到的?这个事件是啥?再让鼠标样式变化,拖动,是什么思路?
      

  2.   

    3:表格列宽的自由调节  是难点,各位给点思路,上面的很简单,做各借鉴,望大家多提意见。另外,对 列的操作 col 有没有办法象操作行 rows 一样简单的办法?addRows,cloneNode 这些办法都不能使用,
      

  3.   

    这里来一份,谢谢!
    [email protected]
      

  4.   

    [email protected]
    我也要学习
      

  5.   

    谢谢
    [email protected]
      

  6.   

    http://www.gdjd.org/imgtemp/tabtest.htm
      

  7.   

    又可以得分,又可以要代码,只要自己打几个字,这世道真好?!
    [email protected]
      

  8.   

    给我也寄一份儿,供学习用,多谢!
    [email protected]
      

  9.   

    [email protected]
     谢谢!!
      

  10.   

    谢谢
    我的email:[email protected]
      

  11.   

    thank you 
    [email protected]
      

  12.   

    [email protected]
    我用HTC做过客户端的dataset,dbEdit ,dbMemo ,dbGrid,combox,PageControl,PIE图,Calendar等。可以互相交流。
      

  13.   

    正想研究一下htc,能给我发一分吗?[email protected]
      

  14.   

    [email protected]    谢谢!!
      

  15.   

    [email protected]
     thanks!