zoukankan      html  css  js  c++  java
  • 第五周(生成动态表格)

    这是这周敲的一段代码,继续努力!知道怎样生成动态表格啦,以后做个人网页的时候或许能用到呢。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>无标题文档</title>

    <script type="text/javascript">

    function init(row,col)

    {

         var str="<table border='1' width='300' height='300'>"     

          for(var i=1;i<=row;i++)     

    {

               str+="<tr>";           

           for(var j=1;j<=col;j++)           

    {

                      str+="<td id='img0' onClick='judge("+((i-1)*col+j)+");'>"+((i-1)*col+j)+"</td>";

               }     

    str+="</tr>";      }     

    str+="</table>"     

    document.getElementById("mt").innerHTML=str; }

    function createTable()

    {       var row=document.getElementById("t1").value;

          var col=document.getElementById("t2").value;

          init(row,col); }

    function judge(temp)

    {     

    alert(temp);  }

    {/script>

    </head>

    <body>

    <div id="mt">text</div>

    <input type="text" value="3" id="t1"/>

    <input type="text" value="3" id="t2"/>

    <input type="button" value="生成表格" onClick="createTable();"/>

    </body>

    </html>

  • 相关阅读:
    AC_9. 分组背包问题
    AC_8. 二维费用的背包问题
    AC_7混合背包问题
    AC_5. 多重背包问题 II
    AC_4. 多重背包问题 I
    AC_3. 完全背包问题
    小郡肝火锅点餐系统——测试部署发布
    Vue脚手架搭建
    归并排序-总结
    小郡肝火锅点餐系统——项目文档
  • 原文地址:https://www.cnblogs.com/aztl/p/5323717.html
Copyright © 2011-2022 走看看