利用纯js实现判断变色功能

版权声明: https://blog.csdn.net/eds124/article/details/85217766
table=document.getElementsByTagName('table');
for(i=0; i<table[0].rows.length; i++){
	if(table[0].rows[i].cells[3].textContent > '2018-12-20'){
		table[0].rows[i].cells[3].style.backgroundColor="red";
	}else{
		table[0].rows[i].cells[3].style.backgroundColor="green";
	}
}

猜你喜欢

转载自blog.csdn.net/eds124/article/details/85217766