SoFunction
Updated on 2025-03-09

js modulo (find remainder) interlaced color change


<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js modulus interlaced line color change</title>
<script type="text/javascript">
=function()
{
 var oUl=('ul1');
 var aLi=('li');

 for(var i=0; i< aLi .length; i++)
 {
if(i%2==0) //Take the modulus and find the remainder
  {
   aLi[i].='red';
  }
 }
}
</script>
</script></head>
<body>
<ul >
 <li>webtall</li>
    <li>webtall</li>
    <li>webtall</li>
    <li>webtall</li>
    <li>webtall</li>
</ul>
</body>
</html>