如果内容不同,此 JavaScript 代码用于更改 div 的背景:
function myfunction() {
$a = document.getElementById('t').getElementsByTagName('div');
var x = 0;
while(x < $a.length) {
var b = ($a[x].innerHTML);
b.toString;
alert(x + b[x]);
if(b == 'PENDING SELECTING TEAM MEMBER' ||b == 'PENDING APPROVAL BY SCHEME MANAGER' ||b == 'PENDING SELECTING TEAM MEMBER' ||b == 'PENDING REVIEW TEAM MEMBER BY LEAD ASSESSOR' ||b == 'PENDING ACKNOWLEDGEMENT BY TA/LA' ||b == 'PENDING PREPARE AUDIT PLAN BY LA' ||b == 'PENDING REVIEW AUDIT PLAN BY AO' ||b == 'PENDING ACCEPT LA BY LAB' ||b == 'PENDING VERIFY REASON BY AO' ||b == 'PENDING CONDUCT ASSESSMENT' || b == 'PENDING CORRECTIVE ACTION BY CAB' || b == 'PENDING REVIEW BY AO' || b == 'PENDING CORRECTIVE ACTION APPROVAL BY SCHEME MANAGER' ||b == 'PENDING APPROVAL BY DOA' ){
document.getElementById('status'+x).style.background="maroon";
alert(x + b);
}
x++;
}
}
它不起作用,因为if
语句失败。
有人可以帮我找出问题所在吗?