• jstl取值 页面js分页


    var begin = 0;
    var end = 3;
    var page = 1;
    var pagesize = 3;
    var orderDetail = '${sessionScope.orderDetail}';
    var jsonList = eval("("+orderDetail+")");
    var length = jsonList.length;
    if(length<=3){
    $("#lastPage").hide();
    $("#nextPage").hide();
    end = length;
    }
    innerhtmlpage(begin,end);
    function innerhtmlpage(begin,end){
    var invar = "";
    for(var i=begin;i<end;i++){
    invar = invar+"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
    invar = invar+ "<tr>";
    invar = invar+ "<td width=\"30%\" class=\"main_content_order_name\">订单名称:</td>";
    invar = invar+ "<td width=\"70%\" class=\"main_content_order_text\">"+jsonList[i].orderName+"</td>";
    invar = invar+ "</tr>";
    invar = invar+ "<tr>";
    invar = invar+ "<td width=\"30%\" class=\"main_content_order_name\">订单号:</td>";
    invar = invar+ "<td width=\"70%\" class=\"main_content_order_text\">"+jsonList[i].orderId+"</td>";
    invar = invar+ "</tr>";
    invar = invar+ "<tr>";
    invar = invar+ "<td width=\"30%\" class=\"main_content_order_name\">交易金额:</td>";
    invar = invar+ "<td width=\"70%\" class=\"main_content_order_text\">"+accDiv(jsonList[i].orderAmt,100)+"元</td>";
    invar = invar+ "</tr>";
    invar = invar+ "<tr>";
    invar = invar+ "<td width=\"30%\" class=\"main_content_order_name\">运费:</td>";
    invar = invar+ "<td width=\"70%\" class=\"main_content_order_text\">"+accDiv(jsonList[i].postage,100)+"元</td>";
    invar = invar+ "</tr>";
    invar = invar+"</table><br>";
    }
    $("#mainPageDIV").html(invar);
    }
    //除法
    function accDiv(arg1,arg2){
    var t1=0,t2=0,r1,r2;
    try{t1=arg1.toString().split(".")[1].length;}catch(e){}
    try{t2=arg2.toString().split(".")[1].length;}catch(e){}
    with(Math){
    r1=Number(arg1.toString().replace(".","")) ;
    r2=Number(arg2.toString().replace(".","")) ;
    return (r1/r2)*pow(10,t2-t1);
    }
    }
    //上一页
    function lastPage1(){
    if(page == 1){
    var begin = 0;
    var end = pagesize;
    }else{
    page = page - 1;
    var begin = page*pagesize-pagesize;
    var end = page*pagesize;
    }
    innerhtmlpage(begin,end);
    }
    //下一页
    function nextPage1(){
    if(page*pagesize-pagesize<length && length<=page*pagesize){
    var begin = page*pagesize-pagesize;
    var end = page*pagesize;
    }else{
    page = page + 1;
    var begin = page*pagesize-pagesize;
    var end = page*pagesize;
    if(begin<length && length<end){
    end = length;
    }
    }
    innerhtmlpage(begin,end);
    }

    1. $.ajax({   
    2. url:"这里是你要请求的地址",   
    3. data:{"id":id}, //以键/值对的形式   
    4. async : false,   
    5. dataType : "json",   
    6. success : function(data) {   
    7. for(int i = 0; i < data.length; i++) { //循环后台传过来的Json数组   
    8.      var datas = data[i];   
    9.      alert(datas.firstName);   
    10.      alert(datas.lastName);   
    11.      alert(datas.email);   
    12. }   
    13. }   
    14. }); 
  • 相关阅读:
    Node.js的Formidable模块的使用
    call 和 apply方法解析
    JavaScript 数组去重方法总结
    Javascript的this用法
    ubuntu虚拟机安装简单pxe服务器
    [LeetCode]Fraction to Recurring Decimal
    [LeetCode]Largest Number
    [LeetCode]Single Number II
    Git & Github使用总结
    vim配置总结
  • 原文地址:https://www.cnblogs.com/yangy608/p/2844051.html
Copyright © 2020-2023  润新知