Oct 18

收藏一段javascriot 不指定

felix021 @ 2009-10-18 13:20 [IT » 网络] 评论(1) , 引用(0) , 阅读(5257) | Via 本站原创 | |
// modified from http://acm.scs.bupt.cn/hefei/hefei.js

String.prototype.trim= function(){  
    // 用正则表达式将前后空格  
    // 用空字符串替代。  
    return this.replace(/(^\s*)|(\s*$)/g, "");  
}

/**
* enables highlight  rows in data tables
*/
function table_Init(container) {
    // for every table row ...
try{
    var rows = container.rows;
    for ( var i = 0; i < rows.length; i++ ) {
        for (var j = 0 ; j < rows[i].cells.length ; ++j) {
            rows[i].cells[j].className = 'nowrap';
            if (j > 3) {
                
                try {
                    var text = rows[i].cells[j].innerHTML;
                    
                    var AC = new RegExp("^\\d+/\\d+$");
                    var TRY = new RegExp("^\\d+/--$");
                    var NOTTRY = new RegExp("^0/--$");
                    if (NOTTRY.test(text)){
                        //rows[i].cells[j].className += ' notry';
                    }
                    else if (TRY.test(text)){
                        rows[i].cells[j].className += ' try';
                    }
                    else if (AC.test(text)){
                        rows[i].cells[j].className += ' ac';
                    }
                }
                catch (err) {
                }
            }
        }
                
        
        // ... with the class 'odd' or 'even' ...
        if (i % 2 == 1) {
            rows[i].className = 'odd';
        }
        else {
            rows[i].className = 'even';
        }

        // ... add event listeners ...
        // ... to highlight the row on mouseover ...
        //if ( navigator.appName == 'Microsoft Internet Explorer' ) {
        // but only for IE, other browsers are handled by :hover in css
        rows[i].onmouseover = function() {
            this.className += ' hover';
        }
        rows[i].onmouseout = function() {
            this.className = this.className.replace( ' hover', '' );
        }
       // }
    }
}
catch (err){
    alert(err.description);
}
}




欢迎扫码关注:




转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php
Me999 Email Homepage
2009-10-19 13:05
没学过!!
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   *非必须
网址   电邮   [注册]