.a1{
background-color:#000000;
}
.a2{
background-color:#000033;
}
.a3{
background-color:#000099;
}
.a4{
background-color:#0000CC;
}
.a5{
background-color:#0000FF;
}
CSS样式大概是这种格式
<html>
<head>
<link rel="stylesheet" type="text/css" href="1.css" />
<script>
function run(){
var x=0;
var z=0;
document.write('<table border="1" align="center" width="500">');
while(x<10){
document.write('<tr>');
x++;
var y=0;
while(y<10){
y++;
z++;
document.write('<td class="a'+z+'" align="center">'+ y +'</td>');
}
document.write('</tr>');
}
document.write('</table>');
document.write('<input type="button" value="撤销" onclick="location.reload() ">')
}
</script>
</head>
<body>
<input type="button" value="建立" onclick="run()">
</body>
</html>
想写个javascript自动生成表格,每个表格对应不同的样式,此功能在不加按键的情况下已经实现,但是加上按键调用方法后就不能实现了,不知道为什么,求大神解答!