标签部分 <s:checkboxlist name="flIds" list="flList" listKey="id" listValue="name" value="flIds" theme="custom" template="customcheckboxlist.ftl"> </s:checkboxlist> customcheckboxlist.ftl是自定义模板,每行显示10个,让后自动换行 <mce:script type="text/javascript"><!-- function submit_onclick(){ var tempId="";//value var tempName="";//显示的值 for(var i=0;i<g("thisForm").flIds.length;i++){ if(g("thisForm").flIds[i].checked){ //获取相邻对象的内容,也就是checkbox的显示值 tempName+=g("thisForm").flIds[i].nextSibling.nextSibling.innerText+","; alert(g("thisForm").flIds[i].nextSibling.nextSibling.innerText); tempId+=g("thisForm").flIds[i].value+","; } } } function g(id){ document.getElementById(id); } // --></mce:script>