js post提交页面

function post(URL, PARAMS) {    

    var temp = document.createElement("form");    

    temp.action = URL;    

    temp.method = "post";    

    temp.style.display = "none";    

    for (var x in PARAMS) {    

        var opt = document.createElement("textarea");    

        opt.name = x;    

        opt.value = PARAMS[x];    

        // alert(opt.name)    

        temp.appendChild(opt);    

    }     

    document.body.appendChild(temp);    

    temp.submit();    

    return temp;    

}     

    

//调用方法 如    

post('pages/statisticsJsp/excel.action', {html :prnhtml,cm1:'sdsddsd',cm2:'haha'});


原文地址:http://blog.csdn.net/wzwlln/article/details/6186520

posted @ 2015-08-11 22:00  临冰听雪丶  阅读(386)  评论(0)    收藏  举报