手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >window.open 以post方式传递参数示例代码
window.open 以post方式传递参数示例代码
摘要:复制代码代码如下://打开新页面并利用post方式传递参数functionopenNewPageWithPostData(postAddre...

复制代码 代码如下:

//打开新页面并利用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;

}

【window.open 以post方式传递参数示例代码】相关文章:

JavaScript获得指定对象大小的方法

JavaScript中的blink()方法的使用

两表格传递变量

快速判断某个值是否在select中的方法

利用js实现禁止复制文本信息

JavaScript中用toString()方法返回时间为字符串

JS实现1000以内被3或5整除的数字之和

Javascript随机显示图片的源代码

剖析Node.js异步编程中的回调与代码设计模式

Ctrl + Enter提交前检测的代码

精品推荐
分类导航