<div class="codetitle"> <span><a style="CURSOR: pointer" data="46403" class="copybut" id="copybut46403" onclick="doCopy('code46403')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code46403"> <br>//打开新页面并利用post方式传递参数 <br>function openNewPageWithPostData(postAddress,opentype,paramNames,paramValues) <br>{ <br>var newWindow = window.open(postAddress,opentype); <br>if (!newWindow) <br>{ <br>return false; <br>} <br><br>var postDataHtml=""; <br>postDataHtml = postDataHtml + "<form id="postDataForm" method="post" action="%22+postAddress+%22">"; <br><br>if (paramNames && paramValues && (paramNames.length == paramValues.length)) <br>{ <br>for(var i=0 ; i<paramnames.length i>{ <br>postDataHtml = postDataHtml + "<input type="hidden" name='"+paramNames[i]+"' value='"+paramValues[i]+"'>"; <br>} <br>} <br><br>postDataHtml = postDataHtml + "</paramnames.length> </form> <script type='\"text/javascript\"'> document.getElementById(\"postDataForm\").submit()<script><body><html>"; <BR>newWindow.document.write(html); <BR>return newWindow; <BR>} <BR></script> </div>