本帖最后由 w156445045 于 2012-05-03 16:52:25 编辑

解决方案 »

  1.   

    web/athlete/athleteAdd.jsp?id=<bean:write property='unitGroupIdTest' />
      

  2.   

    加上去怎么不行呢~
    <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean"%>Can not find the tag library descriptor for "http://struts.apache.org/tags-bean"
      

  3.   

    晕,
    <a href="javascript:onHref();" title="查看运动员" target="topFrame" >新增</a>function onHref(){
      var _obj=document.getElementById('unitGroupIdTest');
      if(_obj){
         //这里改你自己要的提交方式 location.href/submit都行
         windows.location.href='web/athlete/athleteAdd.jsp?id='+_obj.value;
      }
    }
      

  4.   

    解释一下:a 标签的href=不要直接写事件跳转,应该用 onclick做事件跳转,这样做可以避免页面没按我们想要的结果调转!<a href="javascript:void(0)" onclick="goto();" target='topFrame'>新增</a><script type="text/script">
       function goto(){
         var unitGroupIdTest=document.getElementById("unitGroupIdTest");   
         if(unitGroupIdTest){
             windows.location.href="web/athlete/athleteAdd.jsp?id="+unitGroupIdTest.value;
          }
       }
    </script>
      

  5.   

    <a href="javascript:void(0)" onclick="goto();" target='topFrame'>新增</a><script type="text/script">
      function goto(){
      var unitGroupIdTest=document.getElementById("unitGroupIdTest");   
      if(unitGroupIdTest){
      windows.location.href="web/athlete/athleteAdd.jsp?id="+unitGroupIdTest.value;
      }
      }
    </script> 
     
      

  6.   

    1、<input type="hidden" id="unitGroupIdTest" value="<s:property value="unitGroup.id" />"/> 你的这个隐藏域放在循环中,也是会有问题的。你的id,会一样的,你应该把id设置成动态的。
    2、你最好还是使用ls各位说的,用js提交,包括超级链接。
      

  7.   

    您好!
     <script >
      function goto(){
      alert(123);
      var unitGroupIdTest=document.getElementById("unitGroupIdTest");   
      if(unitGroupIdTest){
      windows.location.href="web/athlete/athleteAdd.jsp?id="+unitGroupIdTest.value;
      }
      }
    </script>为什么点了这个链接之后,只输出了123 而后面的缺不执行了呢,页面也没有跳转到新增的页面呢~
      

  8.   

    你把隐藏域放在循环中,var unitGroupIdTest=document.getElementById("unitGroupIdTest");这句话肯定有问题,肯定有多个一样的id为unitGroupIdTest的
      

  9.   

    那我该怎么办呢,
    我页面上的那个连接就是想要获取这个循环中的值呢,其实这个循环中的这个值全部都是一样的呢~="<s:property value="unitGroup.id" /> 这个值 迭代出来的都是相同的请问咋做呢~
      

  10.   

    这种方式我也用过,不过要点两次超链接,因为第一次点只是为href赋值,后来我也没想到什么方法了
      

  11.   

    在生成的时候可以这样
    <input type="hidden" id="unitGroupIdTest${(index)}" value="<s:property value="unitGroup.id" />"/>
    index取你循环的索引号,这样就有多个hidden,然后再用链接的时候这样写
    <a href="javascript:onHref(index);" title="查看运动员" target="topFrame" >新增</a>function onHref(_index){
      var _obj=document.getElementById('unitGroupIdTest'+_index);
      if(_obj){
      //这里改你自己要的提交方式 location.href/submit都行
      windows.location.href='web/athlete/athleteAdd.jsp?id='+_obj.value;
      }
    }
      

  12.   

    这个问题已经解决了找了半天,其实也不是这个index的问题是windows.loation.href
    的问题 windows 多了个s
    正确是应该是window.loation.href哎。。还是火狐好!!!
      

  13.   


    循环中的id应该动态的,否则你js获取的永远都只是第一个id的数值