• 花两个小时,做了个分页控件


    一个简单的分页控件,内置4种显示风格,主要是将AspNetForums的分页跟一个朋友(小熊)的合一块了,ANF的单调了点,小熊的吧,用起来有点麻烦,我人懒,就整一块了.:)
    内置四种风格,通过设置StyleName(BasePager,CoolPager,DiscuzPager,SmallPager)就行,不过要注意大小写,CSS是从Assembly里面取的.
    下面是效果,

    如果想定制一些更炫的效果,就将StyleName设置成其它的任意名字.自己写CSS:
    生成的HTML代码如下:

    <script type="text/javascript">
    //<![CDATA[

                    function xiaokui_pager_go(){
                     var n=event.srcElement;
                     if(event.keyCode==13)
                     {
                      var strUrl=location.href.toLowerCase();
                      strUrl=strUrl.replace(/(\&)?pageindex=\d+/gi,'');
                      if(location.search=='')
                                strUrl=strUrl+'?pageindex='+n.value;
                            else
                                strUrl=strUrl+'&pageindex='+n.value;
                            strUrl=strUrl.replace('?&','?');
                      location.href=strUrl;
                            return false;
                   }
                    }//]]>
    </script>
    <div id="Pager1" class="SmallPager Left">
    <span class="SmallPager_pre">
    <a id="Pager1" class="" id="Prev" href="http://localhost:2625/WebSite/Default.aspx?PageIndex=1">&lt;</a>
    </span>
    <span class="SmallPager_curr">1</span>
    <span class="SmallPager_number"><a id="2" href="http://localhost:2625/WebSite/Default.aspx?PageIndex=2">2</a></span>
    <span class="SmallPager_number"><a id="3" href="http://localhost:2625/WebSite/Default.aspx?PageIndex=3">3</a></span>
    <span class="SmallPager_number"><a id="4" href="http://localhost:2625/WebSite/Default.aspx?PageIndex=4">4</a></span>
    <span class="SmallPager_number"><a id="5" href="http://localhost:2625/WebSite/Default.aspx?PageIndex=5">5</a></span>
    <span class="SmallPager_next"><a id="Next" href="http://localhost:2625/WebSite/Default.aspx?PageIndex=2">&gt;</a></span>
        GO:<input name="txtCustom" type="text" id="txtCustom" onkeydown="return xiaokui_pager_go();" onkeyup="this.value=this.value.replace(/[^0-9]/gi,'');" />
    </div>

    都在Span里面包着.想怎么改,就怎么改.

    代码如下:

    Code



    如果有比我还懒的人,可以直接下载下面的DLL:
    /Files/bqrm/BqrmPager.rar

  • 相关阅读:
    scala学习资料
    maven安装scala插件
    关于 mod_python
    Python读取Excel数据
    Python展开一个嵌套的序列
    随手写的Java向文本文件写字符串的类
    Python三元表达式
    递归的概述
    一分钟让你明白CSS中的盒模型
    Python实现ID3算法
  • 原文地址:https://www.cnblogs.com/bqrm/p/1172477.html
Copyright © 2020-2023  润新知