读书人

window.open (参数运用post方式提交)

发布时间: 2012-07-01 13:15:00 作者: rapoo

window.open (参数使用post方式提交)
一般
window.open 传参数都是用Get..方式..在url后面拼接参数...
有时候并不适用,如:
1)不想被看到参数信息
2)参数过长,get有限制会被截断
3)可能有中文编码问题
所以需要用post方式



<script>function openPostWindow(url, data, name) { var tempForm = document.createElement("form"); tempForm.id="tempForm1"; tempForm.method="post"; tempForm.action=url; tempForm.target=name; var hideInput = document.createElement("input"); hideInput.type="hidden"; hideInput.name= "content" hideInput.value= data; tempForm.appendChild(hideInput); tempForm.attachEvent("onsubmit",function(){ openWindow(name); }); document.body.appendChild(tempForm); tempForm.fireEvent("onsubmit"); tempForm.submit(); document.body.removeChild(tempForm);}function openWindow(name) { window.open('about:blank',name,'height=400, width=400, top=0, left=0, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=yes, status=yes'); } </script>




资料来源:
Window_Open详解
http://www.cnblogs.com/stswordman/archive/2006/06/02/415853.html
Window_Open详解
http://hi.baidu.com/iorichina/blog/item/5a2b323f20a901fc54e72386.html
window.open以post方式提交
http://yuxuguang.iteye.com/blog/895108

读书人网 >操作系统

热点推荐