用JavaScript来生成HTML

<style>
table{
    border-top: 1px #ff0000 solid;
    border-left: 1px #ff0000 solid;
    border-spacing: 0px;
}
table td{
    border-bottom: 1px #ff0000 solid;
    border-right: 1px #ff0000 solid;
}
</style>
<body></body>
<script>
function table1(tdcount){
    var table=document.createElement("table");
    var tr=document.createElement("tr");
    for(var i=0;i<tdcount;i++){
        var td=document.createElement("td");
        td.innerHTML=i+1;
        td.align="center"
        tr.appendChild(td);
    }
    table.appendChild(tr);
    table.width="100%";
    table.height=50;
    return table;
}
for(var i=1;i<=10;i++){
    document.getElementsByTagName("body")[0].appendChild(table1(i));
}
</script>

 

相关文章:

  • 2022-12-23
  • 2021-12-13
  • 2021-05-22
  • 2022-12-23
  • 2022-01-22
  • 2021-12-15
  • 2021-11-05
  • 2022-12-23
猜你喜欢
  • 2021-12-05
  • 2021-08-10
  • 2021-07-12
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案