zoukankan      html  css  js  c++  java
  • 10-17

    今天上午主要是讲了昨天布置的作业,我感觉现在我对这一块的理解真的是不够,用的很生硬。

    <!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>var td_obj;
    function tan(obj){
    td_obj=obj;
    //var tanchuang = document.getElementById("zs");
    obj.innerHTML = prompt("shuru");
    document.getElementById('div').style.display='block';
    obj.setAttribute('abc','abc')
    }

    function td(){
    document.getElementsByTagName("td");
    var tdd = document.getElementsByTagName("td");
    for(var i = 0; i<tdd.length; i++){
    tdd[i].setAttribute('onclick','tan(this)')
    }
    }
    function jc(){
    var tdaaa = document.getElementsByTagName('td');
    for(var i =0; i<=tdaaa.length;i++){
    var saa = tdaaa[i].getAttribute('abc');
    if(saa == "abc"){
    tdaaa[i].style.fontWeight = "bold";
    tdaaa[i].removeAttribute("abc");
    }
    }
    }
    function bh(){
    td_obj.style.color = "red";
    var dd = document.getElementById("div");
    dd.style.display = "none";
    }
    function addcol(){
    // 1、找到父元素(往这里面添加元素)
    var tableObj = document.getElementById("tbb");

    // 2、创建元素 tr td创建td元素 创建tr元素
    var trObj = document.createElement("tr");
    for(var i = 0; i<4;i++){
    var tdObj = document.createElement("td");
    tdObj.innerHTML = "李四";
    // 把td元素放到tr元素里面
    trObj.appendChild(tdObj);
    }

    // 3、把tr放到父元素
    tableObj.appendChild(trObj);

    var dd = document.getElementById("div");
    }
    </script>
    </head>
    <body>
    <table id="tbb" border="1" width="80%" height="100px" cellpadding="0" cellspacing="0">
    <tr>
    <th>姓名</th>
    <th>性别</th>
    <th>年龄</th>
    <th>班级</th>
    </tr>
    <tr>
    <td onclick="td()" id="zs">张三</td>
    <td>女</td>
    <td>99</td>
    <td>11</td>
    </tr>
    </table><div id="div" id="anniu" style="display:none">
    <button onclick="jc()">加粗</button>
    <button onclick="bh()">变红</button>
    </div>
    <button onclick="addcol()">添加</button>
    </body>
    </html>

  • 相关阅读:
    asyncio异步IO--协程(Coroutine)与任务(Task)详解
    python爬虫实战:利用scrapy,短短50行代码下载整站短视频
    深入理解Git的实现原理
    Upsource 代码审查工具安装及使用
    MAC MAMP集成环境安装 PHP 扩展
    千万数据量数据表分表实践
    设计模式:序言
    设计模式 行为型
    PHP5底层原理之变量
    PHP5底层原理之垃圾回收机制
  • 原文地址:https://www.cnblogs.com/Heng23/p/7680726.html
Copyright © 2011-2022 走看看