如何用js做一个九九乘法表隔行换色开关机制

如题所述

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <title> 9X9 乘法表 打印</title>
 <style type="text/css">
  .container{border-left: 1px solid red ;border-bottom: 1px solid red;width: 639px}
  .c{width:70px;display: inline-block; border: 1px solid red;line-height: 30px;height: 30px;text-align: center;border-bottom: none;border-left: none}
  .rowj{color: #000;}
  .rowo{color:red;}
 </style>
 <script type="text/javascript">
  function Nn(){
  document.write("<div class='container'>")
  for(var i=1;i<=9;i++){
  document.write("<div class='row"+((i%2)==0?'o':'j')+"'>");
  for(var j=1;j<=i;j++){
  document.write("<span class='c'>"+(j + "X" + i) + "="+ (i*j) + "</span>");
 
  }
  document.write("</div>")

  }
  document.write("</div>");
  }
  Nn();
 
 </script> 

<body>
 

</body>
</html>

温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-08-23
传入参数

变色就是 行数 当 rownum%2==0 变色

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网