var fval=$("#firstname").val(); var lval=$("#lastname").val(); var age=$("#age").val() ; var percent=$("#percent").val(); //Build table var str='
' '
' fval '
' '
' lval '
' '
' age '< /td>' '
' percent '
'; $("table").append(str); str=""; }) //Set the initial tr number var logo=0; $(document).keydown(function(e){ var table=$("table tr"); //If pagedown is pressed if(e.keyCode==40){ //Remove all tr styles $("tr.bak").removeClass("bak "); //Highlight the currently pointed tr $("tr:eq(" logo ")").addClass("bak"); //Add the tr serial number 1 logo; } //If the tr sequence number exceeds the length of tr, return the first line; if(logo>table.length){ logo=0; } //If the pageup is pressed if(e.keyCode==38){ //The tr serial number is reduced by one from the current serial number, which is to move up one position var l =logo-1; //If the tr serial number is less than 0, that is, the tr serial number at this time should be at the bottom; if(l<0){ l=table.length l;//Reset Calculate tr sequence number } $("tr.bak").removeClass("bak"); $("tr:eq(" l ")").addClass("bak"); logo=l;//Assign the logo to identify the current tr serial number } }) })
Here is the table paging code implemented by jquery. Here are several other table paging implementation methods recommended:
js table paging implementation code
TinyTable javascript table paging and sorting plug-in
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn