window.open 以post方式传递参数
2014-02-27 10:39
851 查看
//打开新页面并利用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;
}
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;
}
相关文章推荐
- window.open url 参数post方式传递
- window.open 以post方式传递参数示例代码
- window.open url 参数post方式传递
- window.open 以post方式传递参数示例代码
- window.open (参数使用post方式提交)
- 在js中window.open通过“post”传递参数
- window.open()实现post传递参数
- JSP中window.open传递中文参数出现乱码的解决方式
- windows.open 以post的方式传递参数
- Window.location.href以post方式传递参数的方法
- 使用window.open打开新窗口,以post方式传参数
- window.open (参数使用post方式提交)
- window.open()实现post传递参数
- 在js中window.open通过“post”传递参数
- window.location.href以post方式传递参数
- Window.location.href以post方式传递参数的方法
- JS: 打开新窗口时(open window),使用传递post参数
- js window.open 传递中文参数出现乱码解决办法
- 在ASP.NET MVC中以post方式传递数组参数的示例
- 使用window.open()传递参数