您的位置:首页 > Web前端

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

2017-07-13 17:04 2771 查看
//前端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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: