关于使用table的width属性为%的错误
firedragon
2007-02-05
下了个最新RC3的版本,当table的width属性使用百分比时,出现了javascript提示:“参数无效”的错误。Me.initScroll里的
alert(twidth); //twidth的值是负数,我这里显示的是-20;p取得的是px; divSX.style.width=twidth+p; |
|
fins
2007-02-05
我这里没有这情况啊
能否把jsp代码发来看看 谢谢了 |
|
firedragon
2007-02-05
页面代码如下:
<div id="tableDiv"> <ec:table items="list" var="list" tableId="usersTableId" action="${pageContext.request.contextPath}/recycleList.do" toolbarLocation="bottom" nearPageNum="2" maxRowsExported="400" toolbarContent="status|export|navigation|pagejump|extend|pagesize|" pageSizeList="max:100,10,15,30,50,100,all" minColWidth="10" resizeColWidth="true" width="100%" listHeight="440px" > <ec:row ondblclick="selectRowByOndbclick(this);"> <ec:column property="no_such_property" title="选择" width="5%"> <input id="${pageScope.list.expopersonid}" name="a" type="checkbox" onclick="changeColor(this)" title="也可以通过双击这一列来选中框框"/> </ec:column> <ec:column property="cardshamdeltime" title="删除时间" width="8%"/> <ec:column property="相片" width="6%" style="height:70"> <html:link action="/personView.do?personid=${pageScope.list.person.personid}"> <img src="<%=request.getContextPath()%>/servlet/FileShowServlet?id=${pageScope.list.person.personid}" border="0" width="49" alt="" /> </html:link> </ec:column> <ec:column property="姓名" width="8%"> <html:link action="/personView.do?personid=${pageScope.list.person.personid}" onclick="switchFrame()"> ${pageScope.list.person.name} </html:link> </ec:column> <ec:column property="国家地区" width="8%"> ${pageScope.list.person.country.countryname} <c:set var="provincename" scope="page"> ${pageScope.list.person.province.provincename} </c:set> <c:if test="${pageScope.provincename !=null}"> ${pageScope.list.person.province.provincename} </c:if> </ec:column> <ec:column property="所属代表团" width="10%"> <input type="hidden" value="${pageScope.list.person.user.userid}"/> ${pageScope.list.person.user.company.team.teamname} </ec:column> <ec:column property="单位名称" width="15%"> ${pageScope.list.person.user.company.companyname} </ec:column> <ec:column property="职位"> ${pageScope.list.person.placename} </ec:column> <ec:column property="审批状态"> <input type="hidden" value=" ${pageScope.list.status.statusid}"> <c:set var="statusid" scope="page"> ${pageScope.list.status.statusid} </c:set> <c:if test="${pageScope.statusid != '2'}"> <font color="#ff0000"> ${pageScope.list.status.statusname} </font> </c:if> <c:if test="${pageScope.statusid == '2'}"> <font color="#000000"> ${pageScope.list.status.statusname} </font> </c:if> </ec:column> <ec:column property="备注" width="6%"> ${pageScope.list.person.notes} </ec:column> </ec:row> </ec:table> </div> 没办法我只好改了twidth ,用document.body.clientWidth后现在可以实现了 var twidth = document.body.clientWidth; //var twidth = ECSideUtil.parseIntOrZero(tableBox.style.width); twidth=twidth-ECSideConstants['SCROLLBAR_WIDTH']; |
|
bjwulin
2007-02-05
这个问题我来回答:
<div id="tableDiv" style="width:100%">加上style就行。不管里面的内容是什么... 这样才能判断twidth。 fins演示的parentNode是body,可以直接取到。 |
|
fins
2007-02-06
谢谢bjwulin
|