User:Brainynight/global.js

//js 中不用寫 這是寫在html裡面

//設定表格大於某個數值顯示不同顏色 function co{ var table = document.getElementById("tab"); var len = table.rows.length; var _row = table.rows; for(var i = 0;i < len;i++){ var _cell = _row[i].cells; var d=_cell[3].innerHTML; if(d<3){ table.rows[i].style.backgroundColor = "blue"; }      else if(d<18){ table.rows[i].style.backgroundColor = "red"; }     else{ table.rows[i].style.backgroundColor = "yellow"; }      }    }

function valueColor{ var table = document.getElementById("tab"); var len = table.rows.length; var _row = table.rows; for(var i = 0;i < len;i++){ var _cell = _row[i].cells; var d=_cell[5].innerHTML; if(d<300){ table.rows[i].style.backgroundColor = 'Bule'; }      else if(d>1800){ table.rows[i].style.backgroundColor = "red"; }     else{ table.rows[i].style.backgroundColor = "yellow"; }      }    }