前端js再新窗口打开页面,以post传递参数方式

来源:互联网 发布:六级分数算法 编辑:程序博客网 时间:2024/05/21 14:52

//前端js打开新页面,以post传递参数

 以下url为请求地址,beginTime为我所需传递的参数,以下方法就是替换成form表单提交的方式实现此功能


var newWindow = window.open(url,"");    

var html = "";

 

html += "<html><head></head><body><form id='formid' method='post' action='"+url+"'>";

    

html += "<input type='hidden' name='beginTime' value='" + beginTime +"'/>";

   

html += "</form><script type='text/javascript'>document.getElementById(\"formid\").submit()</script></body></html>";

 

newWindow.document.write(html);

原创粉丝点击