源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

window.open 以post方式传递参数示例代码

  • 时间:2022-05-04 19:58 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:window.open 以post方式传递参数示例代码
[u]复制代码[/u] 代码如下:
//打开新页面并利用post方式传递参数 function openNewPageWithPostData(postAddress,opentype,paramNames,paramValues) { var newWindow = window.open(postAddress,opentype); if (!newWindow) { return false; } var postDataHtml="<html><head></head><body>"; postDataHtml = postDataHtml + "<form id='postDataForm' method='post' action='"+postAddress+"'>"; if (paramNames && paramValues && (paramNames.length == paramValues.length)) { for(var i=0 ; i<paramNames.length ; i++) { postDataHtml = postDataHtml + "<input type='hidden' name='"+paramNames[i]+"' value='"+paramValues[i]+"'/>"; } } postDataHtml = postDataHtml + "</form><script type=\"text/javascript\"> document.getElementById(\"postDataForm\").submit()<script><body><html>"; newWindow.document.write(html); return newWindow; }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部