项目中有难度的js

1.加载编辑器

  //加载编辑器
    $(function () {
        var editor = KindEditor.create('textarea[name="txtContent"]', {
            resizeType: 1,
            uploadJson: '../../tools/upload_ajax.ashx?action=EditorFile&IsWater=1',
            fileManagerJson: '../../tools/upload_ajax.ashx?action=ManagerFile',
            allowFileManager: true,
            items: [
      'source', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
      'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
      'insertunorderedlist', '|', 'image', 'link']
        });
    });

 

2      //查找所有input ,所有name=wl的元素,取出他的值和一个比较,相等就选中

 $("input[name='xl']").each(function () {
                var cllarr = $(this).attr("value");
                if (cbLevelArr4 == cllarr) {
                    $(this).attr("checked", true);
                }
            });

3.搜索用到的,点击li,点季后改变选中状态

  $(document).ready(function () {

 
            $('.cpzx li:eq(0) a').click(function () {
                $('.cpzx li:eq(0) a').removeClass('buxian');
                $(this).addClass('buxian');
                $("#txt4").attr('value', $(this).text());
            });

            $('.cpzx li:eq(1) a').click(function () {
                $('.cpzx li:eq(1) a').removeClass('buxian');
                $(this).addClass('buxian');
                $("#txt5").attr('value', $(this).text());
            });

            $('.cpzx li:eq(2) a').click(function () {
                $('.cpzx li:eq(2) a').removeClass('buxian');
                $(this).addClass('buxian');
                $("#txt6").attr('value', $(this).text());
            });

            $('.cpzx li:eq(3) a').click(function () {
                $('.cpzx li:eq(3) a').removeClass('buxian');
                $(this).addClass('buxian');
                $("#txt7").attr('value', $(this).text());
            });

            $('.cpzx li:eq(4) a').click(function () {
                $('.cpzx li:eq(4) a').removeClass('buxian');
                $(this).addClass('buxian');
                $("#txt8").attr('value', $(this).text());
            });

            $('.cpzx li:eq(0) a:contains(<%=this.str1 %>)').addClass('buxian');
            $('.cpzx li:eq(1) a:contains(<%=this.str2 %>)').addClass('buxian');
            $('.cpzx li:eq(2) a:contains(<%=this.str3 %>)').addClass('buxian');
            $('.cpzx li:eq(3) a:contains(<%=this.str4 %>)').addClass('buxian');
            $('.cpzx li:eq(4) a:contains(<%=this.str5 %>)').addClass('buxian');

        })
    </script>

4.reapter隔行换

  <asp:Repeater ID="Repeater1" runat="server">
                    <ItemTemplate>
                        <tr <%#getstyle2(Container.ItemIndex+1)%>>

 //样式
        protected string getstyle2(int i)
        {
            string str = "";
            if (i % 2 == 0)
            {
                str = "class=\"hui\"";
            }
            else
            {
                str = "class=\"bai\"";
            }
            return str.ToString();
        }

 

        protected string BindRadioList(string x, string data_name)
        {

            string str = "";
            Shcg.BLL.WL.dt_State bll = new BLL.WL.dt_State();
            DataTable dt = bll.GetList("Id=8").Tables[0];
            if (dt.Rows.Count > 0 && dt.Rows != null)
            {
                string strarr = dt.Rows[0]["" + data_name + ""].ToString();
                string[] arrStr = strarr.Split('|');//字段是以","隔开

                for (int i = 0; i < arrStr.Length; i++)
                {

                    str += "<a href=\"javascript:void(0);\">" + arrStr[i] + "</a>";

                }
            }
            return str.ToString();
        }

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值