JQuery table改变列的宽度
JQuery 使table的tr 变成可变宽窄的.1.首先要引用两个js
2.在ready的时间调用movedTh()方法.这时table的id要一致
3. table 的td 要换成th
4.table 还有两个属性 table-layout:fixed
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>table改变列宽---实例</title><SCRIPT src="jquery-1.4.1.min.js" mce_src="jquery-1.4.1.min.js" type="text/javascript"></SCRIPT><SCRIPT src="jtablemovesize.js" type="text/javascript"></SCRIPT></head><script language="javascript" type="text/javascript">/* * 2、设置每列的列头为可拖动大小 */$().ready(function(){$("#bodymaintable").movedTh();})</script><body><div><table id="bodymaintable" cellPadding=3 STYLE="table-layout:fixed;" mce_STYLE="table-layout:fixed;" border=1><tr> <th width="48">编号</th> <th width="114">名称</th> <th width="106">规格</th></tr><tr> <th>123456</th> <th>贴片电阻</th> <th>1K±5%</th></tr><tr> <th>789123</th> <th>贴片电容</th> <th> 0.1uF/25V </th></tr</table></div></body></html>
页:
[1]