设置表单的名字和不同的value值
服务器端在做处理,不知道是不是这个意思!

解决方案 »

  1.   

    不知道是不是这个意思。
    <script>
      function check(btn){
         location.href= btn.id=="btn1"?"xxx.jsp?&param="+2:"xxx.jsp?&param="+3
        // alert(btn.id=="btn1"?"xxx.jsp?&param="+2:"xxx.jsp?&param="+3);
      }
    </script>
    <form action="" method='post'>
     <input id='btn1' type=button value='按钮1' onclick='check(this)'><br/>
     <input id='btn2' type=button value='按钮2' onclick='check(this)'><br/>
    </form>
      

  2.   

    没看明白楼上写的是什么。忘了说了,我用的是ASP,参数的意思,就是一个变量(参数)带不同的值(2或3)下一个页面根据这个参数做不同的操作
      

  3.   

    例如:
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function Button1(){
              with  (document.Success_tj)
             {
                     action="success.asp";
                     submit();
     }}
    function Button2(){
              with  (document.Success_tj)
             {
                     action="success.asp";
                     submit();
     }}
    //-->
    </SCRIPT>
    两个按钮对应不同的脚本,提交到同一页面,但怎么带参数呢。
    success.asp?cs=2  这样能行吗?
      

  4.   

    1.Ajax
    2.iframe
    3.刷新本页面3 2楼已经有了, 说一下第二个吧:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
      <script>
      function check(v){
    document.getElementById('fra').src = 'url?p=' +v; 
      }
      </script> </HEAD> <BODY>
     <input id='btn1' type=button value='按钮1' onclick='check("2")'><br/>
     <input id='btn2' type=button value='按钮2' onclick='check("3")'><br/>  <iframe id=fra style='width:0px;height:0px'></iframe>
     </BODY>
    </HTML>如果请求没有回应建议用第三种方式(当然有回应也可以用)。
      

  5.   

    晕了,那我写简单点吧。。
    <script>
      function check(btn){
         if(btn.id == "btn1"){
             // 点击的是第一个按钮,则传入参数 为2
            location.href= "xxx.jsp?&param="+2
         }else if(){
             // 点击的是第二个按钮,则传入参数 为3
            location.href= "xxx.jsp?&param="+3;
         }
      }
    </script>
    <form action="" method='post'>
     <input id='btn1' type=button value='按钮1' onclick='check(this)'><br/>
     <input id='btn2' type=button value='按钮2' onclick='check(this)'><br/>
    </form>
      

  6.   


    晕死,你都知道这个
    为什么不直接action="success.asp?canshu=2";和action="success.asp?canshu=3";
      

  7.   

    呵呵,成功了,我不知道action="success.asp?canshu=2"这样能不能传过去,这也是在问各位的情况下想到的Ghost_520的方法不行,其他的参数都没有传过去,也没有取到参数。不过也谢谢费心了再次谢谢各位
      

  8.   

    真囧,我的链接参数写错了 ,刚才多了一个 “&” 符号,你再试试。<script>
      function check(btn){
         if(btn.id == "btn1"){
             // 点击的是第一个按钮,则传入参数 为2
            location.href= "xxx.jsp?param="+2;
         }else if(){
             // 点击的是第二个按钮,则传入参数 为3
            location.href= "xxx.jsp?param="+3;
         }
      }
    </script>
    <form action="" method='post'>
     <input id='btn1' type=button value='按钮1' onclick='check(this)'><br/>
     <input id='btn2' type=button value='按钮2' onclick='check(this)'><br/>
    </form>