怎样让Javascript的值传到css里面去?
下面is的值是1-7的随机数。
<script>
id = Math.round(Math.random()*2)+1;
ic = Math.round(Math.random()*2)+1;
is=id+ic;
if ((id == 2)&&(ic == 2))
{
is=1;
}
if ((id == 3)&&(ic == 2))
{
is=7;
}
document.write("这是" + is + "数");
</script>
我想将is的1-7分别代表7种颜色,传到下面的CSS里。有什么方法吗?
传到 background:#d90005;去。好让我的网页某个表格颜色刷新一次变一次。
<style type="text/css">
.class2
{
background:#d90005;
}
</style>