Oct
18
// 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);
}
}
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
2009-10-19 13:05
没学过!!
分页: 1/1 1