Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 以HTML格式发送Google工作表电子邮件_Javascript_Html_Css_Google Apps Script_Html Table - Fatal编程技术网

Javascript 以HTML格式发送Google工作表电子邮件

Javascript 以HTML格式发送Google工作表电子邮件,javascript,html,css,google-apps-script,html-table,Javascript,Html,Css,Google Apps Script,Html Table,我想将CSS代码应用于具有不同颜色的奇数行和偶数行,但我被困在一个地方,我不知道如何将此代码应用于表的正文部分,下面是我的代码 <style> #customers { font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; border-collapse: collapse; width: 100%; } #customers td, #customers th { border:

我想将CSS代码应用于具有不同颜色的奇数行和偶数行,但我被困在一个地方,我不知道如何将此代码应用于表的正文部分,下面是我的代码

<style>
#customers {
  font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

#customers td, #customers th {
  border: 1px solid #ddd;
  padding: 8px;
}

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customersbody tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}

#customers th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #4CAF50;
  color: white;
}
</style>  

     <table id="customers">
            <thead>
               <tr >
                  <th><?= name ?></th>
                  <th><?= target ?></th>
                  <th><?= deliveries ?></th>
                  <th><?= shortfall ?></th>
                  <th><?= advances ?></th>
                  <th><?= acheivement ?></th>         
               </tr>   
            </thead>
          <tbody>
            <? tableRangevalues.forEach(r => {?>
               <tr >
                  <td><?= r[0] ?></td>
                  <td><?= r[1] ?></td>
                  <td><?= r[2] ?></td>
                  <td><?= r[3] ?></td>
                  <td><?= r[4] ?></td>
                  <td><?= r[5] ?></td>    
               </tr> 
                  <? }) ?>   
            </tbody>
          <tfoot>
               <tr >
                   <th><?= Totalname ?></th>
                   <th><?= Totaltarget ?></th>
                   <th><?= Totaldeliveries ?></th>
                   <th><?= Totalshortfall?></th>
                   <th><?= Totaladvances ?></th>
                   <th><?= Totalacheivement ?></th> 
               </tr>   
            </tfoot>
          </table>

#顾客{
字体系列:“投石机MS”,Arial,Helvetica,无衬线;
边界塌陷:塌陷;
宽度:100%;
}
#客户td,#客户th{
边框:1px实心#ddd;
填充:8px;
}
#客户tr:n子(偶数){背景色:#f2f2f2;}
#CustomerBody tr:n子项(偶数){背景色:#f2f2f2;}
#客户tr:hover{背景色:#ddd;}
#顾客{
填充顶部:12px;
垫底:12px;
文本对齐:左对齐;
背景色:#4CAF50;
颜色:白色;
}
表体行号可以不同。那么如何将CSS添加到上述代码tbody
注意:我不是程序员

CSS有一个ID为
CustomerBody
的规则。要将该ID应用于表体元素,请更改



CSS有一个ID为
CustomerBody
的规则。要将该ID应用于表体元素,请更改




当我学会了一些编码时,我实际上将该部分添加到了CSS中,甚至尝试了使用该表,但没有成功。由于我很少学习编码,我实际上将该部分添加到CSS中,甚至尝试使用该表,但没有效果。我正在使用您的代码,每一行都根据
#客户tr:nth child(偶数){background color:#f2f2;}
成功格式化。这不是你想要完成的吗?我正在使用你的代码,每一行都根据
#客户tr:n子(偶数){背景色:#f2f2f2;}
成功格式化。这不是你想要完成的吗?