To create an ajax paging function, you need to obtain the value of the href attribute.
Html file
| The code is as follows: |
Copy code |
<Div id = "ajaxpage"> <Span> 47/10 pages </span> <A href = "? Page = 0 "onclick =" return false "> page 1 </a> <A href = "? Page = 2 "onclick =" return false "> Previous page </a> <A href = "? Page = 0 "onclick =" return false "> 1 </a> <A href = "? Page = 1 "onclick =" return false "> 2 </a> <A href = "? Page = 2 "onclick =" return false "> 3 </a> <A href = "? Page = 3 "onclick =" return false "> 4 </a> <A href = "? Page = 4 "onclick =" return false "> 5 </a> <A href = "? Page = 5 "onclick =" return false "> 6 </a> <A href = "? Page = 4 "onclick =" return false "> Next page </a> <A href = "? Page = 9 "onclick =" return false "> Last page </a> </Div> |
It is sufficient to use the jQuery attr method in common traffic generators.
Var url = $ (this). attr ('href ');
However, what we get under IE6 is not the correct property value, but the URL with the domain name. This is not a jQuery bug, it is an ie problem, and will not happen in the high version.
Example: http://www.111cn.net? Page = 2
Special solutions are needed to solve this problem.
Solution
| The code is as follows: |
Copy code |
Var url = $ (this). attr ('href '); Var base = window. location. href; Var endIndex = url. lastIndexOf ("? "); If (endIndex ){ Base = window. location. href. substring (0, endIndex ); } Url = url. replace (base ,""); |