分页跳转按钮:

javascript中live支持多次click事件_click

<script>
    $(function(){
            $('#public_ym_left').live('click',function(){
                //<符号的右侧的第一个号
                        
            var sibQ=$('#public_ym_left').next().text();
                    
            if(sibQ>=1&&sibQ<=5) var start=1;
            if(sibQ>5)
                var start=parseInt(sibQ)-4;
                    
            $("#upage").children().remove();
            var childQ=$('<li id="public_ym_left"><a href="javascript:void(0)"></a></li>');
            var childH=$('<li id="public_ym_right"><a href="javascript:void(0)"></a></li>');
            var loage=$('<li><a href="javascript:void(0)">......</a></li>');   
            $("#upage").append(childQ);
                    
            for(var i=start;i<(start+5);i++)
            {
                var son=$('<li><a class="vpage" id="page'+i+'" href="javascript:void(0)">'+i+'</a></li>');
                $("#upage").append(son);
            }
                $("#upage").append(loage);
                $("#upage").append(childH);
                $('#public_ym_left').unbind();
        });
                
        $('#public_ym_right').live('click',function(){
                    
            var sibH=$('#public_ym_right').prev().prev().text();
                    
                    
            var start=parseInt(sibH);
            $("#upage").children().remove();
            var childQ=$('<li id="public_ym_left"><a href="javascript:void(0)"></a></li>');
            var childH=$('<li id="public_ym_right"><a href="javascript:void(0)"></a></li>');
            var loage=$('<li><a href="javascript:void(0)">......</a></li>');   
            $("#upage").append(childQ);
                
            for(var i=start;i<(parseInt(start)+5);i++)
            {
                var son=$('<li><a class="vpage" id="page'+i+'" href="javascript:void(0)">'+i+'</a></li>');
                $("#upage").append(son);
            }
                $("#upage").append(loage);
                $("#upage").append(childH);
            $('#public_ym_right').unbind();
        });
                
    });
</script>





<div class="public_ym">
    <ul id="upage">
      <li id="public_ym_left"><a href="javascript:void(0)" ></a></li>
        
      <li class="vpage"><a id="page1" class="vpage" href="javascript:void(0)">1</a></li>
      <li class="vpage" ><a id="page2" class="vpage" href="javascript:void(0)">2</a></li>
      <li class="vpage"><a  id="page3" class="vpage" href="javascript:void(0)">3</a></li>
      <li class="vpage" ><a id="page4" class="vpage" href="javascript:void(0)">4</a></li>
      <li class="vpage" ><a id="page5" class="vpage" href="javascript:void(0)">5</a></li>
       
     <li><a href="javascript:void(0)">......</a></li>
      <li id="public_ym_right"><a href="javascript:void(0)"></a></li>
    </ul>
    <table border="0" cellpadding="0" cellspacing="0" class="public_tzy">
       <tr>
         <td width="64" align="right">跳转到第</td>
         <td width="57" align="center"><input name="" type="text" class="ym_tzys" /></td>
         <td width="59">共<span>100</span>页</td>
       </tr>
    </table>
   </div>