1016 Repeater-重复器

Repeater-重复器,放表格的

五大模板:
HeaderTemplate -表头
ItemTemplate - 表格的内容
FooterTemplate - 说白了就放</table>

AlternatingItemTemplate - 与ItemTemplate搭配用,间隔颜色不同

数据绑定:

Repeater1.DataSource-数据源指向

Repeater1.DataBind();数据绑定

问题一:
 将数据显示成最终数据
 字段扩展(在封装成员变量的时候就写好了)
 
问题二:
 将年龄在16岁以上的人员标红

也使用字段扩展
 
问题三:
 光棒效果,并且保留原有颜色

使用方法

  var oItems = document.getElementsByClassName("tr_item");//获取表格
            for (var i = 0; i < oItems.length; i++)
            {
                var oldColor = "";//记录原来的颜色

                 //移入变色
                oItems[i].onmouseover = function () {
                    oldColor = this.style.backgroundColor;
                    this.style.backgroundColor = "yellow";
                };

                //移出变回原来颜色

                oItems[i].onmouseout = function () {
                    this.style.backgroundColor = oldColor;

                };
            }

原文地址:https://www.cnblogs.com/a12110303043/p/5967311.html