码迷,mamicode.com
首页 > Web开发 > 详细

20151217JS便签

时间:2016-01-02 20:30:09      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:

JS便签:
    根据一个数值来改变Repeater行数的颜色
        <script type="text/javascript">
        var query = document.getElementsByClassName("kc");
        for (var i = 0; i < query.length; i++) {
            var num = query[i];
            var k = query[i].innerText;
            if (k >= 20) {

            } 
            else {
                var hang = num.parentNode;
                hang.setAttribute("bgcolor", "#FF0033");
            }
        }
    </script>

添加成功:
Literal1.Text = "<script type=‘text/javascript‘>alert(‘"+"添加成功"+"‘)</script>"


 模糊查询:
     string ids = TextBox1.Text;
        string name = TextBox2.Text;
        DataClassesDataContext context = new DataClassesDataContext();
        List<Fruit> list = context.Fruit.ToList();
        if (ids != "")
        {
            list = list.Where(r => r.Ids.Contains(ids)).ToList();
        }
        if (name != "")
        {
            list = list.Where(r => r.Name.Contains(name)).ToList();
        }
        Repeater1.DataSource = list;
        Repeater1.DataBind();

 

20151217JS便签

标签:

原文地址:http://www.cnblogs.com/hz1234/p/5095082.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!