有一个表单,下面有三个按钮,分别提交到不同的地址,怎么写JS?给出代码,解决马上给分

解决方案 »

  1.   

    ==>
    onclick form action ==> edit
    submit()
      

  2.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 1</title>
    </head><body><form method="POST" action="--WEBBOT-SELF--">
    <!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
    <input type=text name="t1"/>
    <p> </p>
    <input type=button value="提交一"/>

    <input type=button value="提交一"/>

    </form></body></html>
    不懂js,望补充至能用,谢谢
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    </html>
    <head> 
    <head>
    </head>       
    <body>      
    <form name="fm" id="fm">
    <input type="button" value="submit1" onclick="this.form.action='1.html';this.form.submit();" />
    <input type="button" value="submit2" onclick="this.form.action='2.html';this.form.submit();" />
    <input type="button" value="submit3" onclick="this.form.action='3.html';this.form.submit();" />
    </form>
    </body>   
    </html>
      

  4.   

    var myForm = document.forms["from1"];
    myForm.setAttribute("action","aaa.asp");
    myForm.submit();
      

  5.   

    4楼最满意,不过写错一个</html>,多谢各位,马上结贴
      

  6.   

    请参考
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script language="javascript">
    window.onload = function() {
        var btn1 = document.getElementById("btn1");
        var btn2 = document.getElementById("btn2");
        var btn3 = document.getElementById("btn3");
        btn1.onclick = function() {
            document.forms[0].action = "http://www.baidu.com";
            document.forms[0].submit();
        };
        btn2.onclick = function() {
            document.forms[0].action = "http://www.google.com";
            document.forms[0].submit();
        };
        btn3.onclick = function() {
            document.forms[0].action = "http://www.yahoo.com";
            document.forms[0].submit();
        };
    };
    </script>
    </head><body>
    <form method="post" action="test.html">
    <input type="button" value="提交1" id="btn1" />
    <input type="button" value="提交2" id="btn2" />
    <input type="button" value="提交3" id="btn3" /></form></body>
    </html>