手机
当前位置:查字典教程网 >编程开发 >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方式传递参数示例代码】相关文章:

JS通过Cookie判断页面是否为首次打开

Ctrl + Enter提交前检测的代码

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

js控制网页前进和后退的方法

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

AspNet中使用JQuery boxy插件的确认框

js实现文本框选中的方法

超酷右下浮出广告窗口代码

JavaScript中的blink()方法的使用

jQuery获得字体颜色16位码的方法

精品推荐
分类导航