css
<style>
td{
height: 50px;
width: 50px;
}
</style>
html
<table border="1px">
</table>
js:
定时器一定要遵守先清后设
<script>
var table = document.getElementsByTagName("table")[0];
for(var i = 0;i<5;i++){
var tr = document.createElement("tr");
for(var j = 0;j<5;j++){
var td = document.createElement("td");
tr.appendChild(td);
if(i==0||i==4){
td.setAttribute("class","chose")
}
else if((j==0||j==4)&&(i==1||i==2||i==3)){
td.setAttribute("class","chose")
}else if(j==2&&i==2){
td.setAttribute("id","begin");
}
else{