js 向action 传长参数

 

function openWindowWithPost(url,name,keys,values)
{
var newWindow = window.open(url, name); 
if (!newWindow) return false;
var html = "";
html 
+= "<html><head></head><body><form id='formid' method='post' action='" + url + "'>";
if (keys && values && (keys.length == values.length))
for (var i=0; i < keys.length; i++)
{
//alert(keys[i]+"="+values[i]);
html += "<input type='hidden' name='" + keys[i] + "' value=\"" + values[i] + "\"/>";
}

html 
+= "</form><script type='text/javascript'>document.getElementById(\"formid\").submit()</script></body></html>";
newWindow.document.write(html);
return newWindow;
}

posted on 2008-12-16 15:49 deepbluesea 阅读(663) 评论(0)  编辑  收藏 所属分类: JS


只有注册用户登录后才能发表评论。


网站导航:
 
<2008年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

导航

统计

公告

MSN:zzlljj8833@hotmail.com lava:5832911

常用链接

留言簿(1)

随笔分类(9)

随笔档案(18)

文章分类(1)

文章档案(1)

搜索

最新评论

阅读排行榜

评论排行榜