你的做法显然不行,因为php脚本执行完以后$name,$sex是没有值的
解决方法:
<INPUT TYPE="button" VALUE="打印" NAME="print" onclick="javascript:window.open('tow.php?xingming='+document.form2.name.value+'&xingbie='+document.form2.sex.value+')">
语法可能有错误,但意思应该可以明白

解决方案 »

  1.   

    <FORM METHOD=POST NAME="FORM2" action="ShowServlet">
    <INPUT TYPE="button" VALUE="查詢" NAME="search" onclick="document.FORM2.action='ShowServlet';document.FORM2.submit()">
    <INPUT TYPE="button" VALUE="打印" NAME="print" onclick="document.FORM2.action='PrintServlet';document.FORM2.submit()">
    </FORM>主要是document.FORM2.action=“”的方法
    可以的话请给分,我还等着过年呢!
      

  2.   

    yanchang(笨笨)
    妳的方法是可以﹐但是我是想在form的的頁面里單擊打印按鈕后打開一個新的窗口﹐而原來的窗口還要保留﹐能不能再幫我想想辦法﹖謝謝了﹐做出來馬上給分﹒
      

  3.   

    qsnake(呵呵)
    不行﹐你的方法錯誤而且沒有任何反應﹒
      

  4.   

    <FORM METHOD=POST NAME="FORM2" action="ShowServlet" target="_self">
    <INPUT TYPE="button" VALUE="查詢" NAME="search" onclick="document.FORM2.action='ShowServlet';document.FORM2.submit()">
    <INPUT TYPE="button" VALUE="打印" NAME="print" onclick="document.FORM2.action='PrintServlet';document.FORM2.target='_blank';document.FORM2.submit();">
    </FORM>
    放啊!!!!
    document.FORM2.target=
      

  5.   

    <INPUT TYPE="button" VALUE="打印" NAME="print" onclick="javascript:window.open('tow.php?xingming='+document.FORM2.name.value+'&xingbie='+document.FORM2.sex.value)">
      

  6.   

    我搞定了,你照这样做。
    <script language="javascript">
    function judge1()
       {document.FORM2.action="aaa.php";
        document.FORM2.submit();
        return true;
       
       }
    function judge2()
       {document.FORM2.action="bbb.php";
        document.FORM2.target="_blank";
        document.FORM2.submit();
        return false;
       
       }
    </script>
    <FORM METHOD=POST NAME="FORM2">
    <INPUT TYPE="text" NAME="name">
    <INPUT TYPE="text" NAME="sex">
    <INPUT TYPE="button" VALUE="查詢" NAME="search" onclick="return judge1();">
    <INPUT TYPE="submit" VALUE="打印" NAME="print"  onclick="return judge2();">
    </FORM>