当前位置:网站首页 > 更多 > 站长帮 > 正文

[WEB] 课表HTML有课的随机背景颜色

作者:CC下载站 日期:2021-04-26 00:00:00 浏览:72 分类:站长帮

td{
border-radius:5%;
}
<fontcolor="#ffffff">
<tableborder="0"width="100%"align="center"style="font-size:0.5rem"bgcolor="#fec7ff"
height="700">
<tralign="middle"style="font-weight:bold">
<tdwidth="30"></td>
<tdwidth="50"align="center"height="30">周一</td>
<tdwidth="50"align="center"height="30">周二</td>
<tdwidth="50"align="center"height="30">周三</td>
<tdwidth="50"align="center"height="30">周四</td>
<tdwidth="50"align="center"height="30">周五</td>
<tdwidth="50"align="center"height="30">周六</td>
<tdwidth="50"align="center"height="30">周日</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">1</td>
<tdbgcolor="#73b3f0"rowspan="2">{{course.0.0|safe}}</td>
<tdrowspan="2">{{course.1.0|safe}}</td>
<tdrowspan="2">{{course.2.0|safe}}</td>
<tdrowspan="2">{{course.3.0|safe}}</td>
<tdrowspan="2">{{course.4.0|safe}}</td>
<tdrowspan="2">{{course.5.0|safe}}</td>
<tdrowspan="2">{{course.6.0|safe}}</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">2</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">3</td>
<tdrowspan="2"align="middle">{{course.0.1|safe}}</td>
<tdrowspan="2">{{course.1.1|safe}}</td>
<tdrowspan="2">{{course.2.1|safe}}</td>
<tdrowspan="2">{{course.3.1|safe}}</td>
<tdrowspan="2">{{course.4.1|safe}}</td>
<tdrowspan="2">{{course.5.1|safe}}</td>
<tdrowspan="2">{{course.6.1|safe}}</td>
<tdrowspan="2">{{course.7.1|safe}}</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">4</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">5</td>
<tdrowspan="2">{{course.0.2|safe}}</td>
<tdrowspan="2">{{course.1.2|safe}}</td>
<tdrowspan="2">{{course.2.2|safe}}</td>
<tdrowspan="2">{{course.3.2|safe}}</td>
<tdrowspan="2">{{course.4.2|safe}}</td>
<tdrowspan="2">{{course.5.2|safe}}</td>
<tdrowspan="2">{{course.6.2|safe}}</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">6</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">7</td>
<tdrowspan="2">{{course.0.3|safe}}</td>
<tdrowspan="2">{{course.1.3|safe}}</td>
<tdrowspan="2">{{course.2.3|safe}}</td>
<tdrowspan="2">{{course.3.3|safe}}</td>
<tdrowspan="2">{{course.4.3|safe}}</td>
<tdrowspan="2">{{course.5.3|safe}}</td>
<tdrowspan="2">{{course.6.3|safe}}</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">8</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">9</td>
<tdrowspan="2">{{course.0.4|safe}}</td>
<tdrowspan="2">{{course.1.4|safe}}</td>
<tdrowspan="2">{{course.2.4|safe}}</td>
<tdrowspan="2">{{course.3.4|safe}}</td>
<tdrowspan="2">{{course.4.4|safe}}</td>
<tdrowspan="2">{{course.5.4|safe}}</td>
<tdrowspan="2">{{course.6.4|safe}}</td>
</tr>
<tralign="middle">
<tdstyle="font-weight:bold">10</td>
</tr>
</table>
</font>
<scriptsrc="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script>
varchars=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'];

functiongenerateMixed(n){
varres="";
for(vari=0;i<n;i++){
varid=Math.ceil(Math.random()*16);
res+=chars[id];
}
returnres;
}

$('td').each(function(){
if($(this).text().length>2&&$(this).text()!==''){
$(this).css('background','#'+Math.random().toString(16).substr(2,6).toUpperCase())
}
})
</script>


您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯