window.open 以post方式傳遞參數(shù)示例代碼
更新時(shí)間:2014年02月27日 11:24:02 作者:
這篇文章主要介紹了window.open以post方式傳遞參數(shù)的方法,需要的朋友可以參考下
復(fù)制代碼 代碼如下:
//打開新頁面并利用post方式傳遞參數(shù)
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;
}
相關(guān)文章
JS取request值以及自動(dòng)執(zhí)行使用示例
在網(wǎng)頁中JS函數(shù)自動(dòng)執(zhí)行常用三種方法,下面為大家詳細(xì)介紹下JS取request值以及自動(dòng)執(zhí)行使用,需要的朋友可以參考下2014-02-02javascript實(shí)現(xiàn)輪顯新聞標(biāo)題鏈接
這篇文章主要介紹了javascript實(shí)現(xiàn)輪顯新聞標(biāo)題鏈接的相關(guān)資料,需要的朋友可以參考下2007-08-08JavaScript實(shí)現(xiàn)輸入框(密碼框)出現(xiàn)提示語
有時(shí)候我們需要在登陸表單有一些提示語言,比如“請(qǐng)輸入用戶名”和“請(qǐng)輸入密碼”等語言,通過本文給大家介紹JavaScript實(shí)現(xiàn)輸入框(密碼框)出現(xiàn)提示語的相關(guān)知識(shí),對(duì)js實(shí)現(xiàn)輸入框提示相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧2016-01-017個(gè)讓JavaScript變得更好的注意事項(xiàng)
這篇文章主要介紹了7個(gè)讓JavaScript變得更好的注意事項(xiàng),十分詳盡,需要的朋友可以參考下2015-01-01