简单CSS&Js

来源:互联网 发布:问卷网有数据分析吗 编辑:程序博客网 时间:2024/05/22 04:39

1、td里自动换行(免得撑爆) 

           style="word-break:break-all" 

           style="word-wrap:break-word"

 

2、为td添加事件

    var obj=datatable.rows[i].cells[7];
    obj.onmouseover=function(){this.bgColor='#FFE3D2';}
    obj.onmouseout=function(){this.bgColor='';};

 

3、为tr加样式

     datatable.rows[i].style.backgroundColor="lightyellow";

 

4、去空格

  errcde=errcde.replace(/(^/s*)|(/s*$)/g,"");

或添加一方法:String.prototype.trim=function(){ return this.replace(/(^/s*)|(/s*$)/g,""); }

 

原创粉丝点击