<logic:iterate id="QueryClass" name="QueryClass" indexId="i">
            
                <tr>
    <td><bean:write name="QueryClass" property="course_Id"/></td>
    <td><bean:write name="QueryClass" property="course_Name"/></td>
    <td><bean:write name="QueryClass" property="course_Type"/></td>
    <td><bean:write name="QueryClass" property="course_XF"/></td>
    <td><bean:write name="QueryClass" property="t_Name"/></td>
    <td><bean:write name="QueryClass" property="time"/></td>
    <td><bean:write name="QueryClass" property="position"/></td>
    <td>
   
    <html:link action="/select" paramId="ChoiceId" paramName="i" onclick="javascript:show();">挑选</html:link>
 
    </td>
    </tr>
            
            </logic:iterate>
初学JS  我想点击“挑选”的超链接,弹出一个comfirm()对话框  如果点是就跳转到select.do 同时把ChoiceId的值传过去, JS该怎么获取这个ChoiceId的值呢  求指教

解决方案 »

  1.   

    javascript:show(ChoiceId) 
    可以传过去不
      

  2.   

    可以尝试用下:<html:link action="/select" paramId="ChoiceId" paramName="i" onclick="javascript:show(this);">挑选</html:link>
    ,然后在show(obj)方法中通过$(obj).val()获取值
      

  3.   

    试过了 不行
    function show(obj){
    alert($(obj).val());
    }
      

  4.   

    可以定义一个隐藏栏位,通过$(obj).parent()找到td,然后再parent()找到tr,然后再find("td:eq(隐藏栏位对应的td的位置)"),即:
    $(obj).parent().parent().find("td:eq(5)").value();//这里的5是指隐藏栏位在第6个td里面。
    你还可以试下这个:
    $(obj).attr("paramId");//你可以看看在页面上解析出来的是什么样子,看看有没有把paramId="ChoiceId"中的choiceId解析成真正的id。