日期:2014-05-17 浏览次数:20614 次
<c:forEach items="${map}" var="item" > <tr class="tr_data1"> <td width=17% align="right">${item.key.broough}${item.key.road}${item.key.tabletNum}</td> <c:forEach items="${item.value}" var="item1" > <td colspan="2" style="word-wrap: break-word;word-break:break-all;">${item1.cellNum}单元${item1.floorNum}${item1.maproomNum}</td> </c:forEach> </tr> </c:forEach>
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>test</title> <script type="text/javascript" src="jquery-1.7.2.min.js"></script> <script type="text/javascript"> window.onload = function(){ var value = ["mmmmmmmmmmmmmmmm","yyyyy","eeeeeeeeeeewwwwwwwwwwwwwweee","ss","ssssssssssssssssssssssssss"]; var r = document.getElementById("tab").rows.length; for(var i = 0;i < r;i++){ for(var j = 0;j < document.getElementById("tab").rows[i].cells.length;j++){ var v = value[parseInt(Math.random()*5)]; //规定字符串长度为20,超过20自动换行 if(v .length > 20){ var vv = v.substring(0,20) + "<br>" + v.substring(20,v.length); document.getElementById("tab").rows[i].cells[j].innerHTML = vv; }else{ document.getElementById("tab").rows[i].cells[j].innerHTML = v; } } } } </script> </head> <body> <table border="1" id="tab"> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </table> </body> </html>