<table id="c1" width="98%" border="1px" cellspacing="0" cellpadding="0" >
//jQuery代码
function demo1() {
//var dd = document.getElementsByName('t1')[0].value;//通过名字,得到input中值,遍历是从0开始的
//var testLength = document.getElementById('test1').value.length;
var testLength = document.getElementById("c1").rows[0].cells[0].offsetWidth; //表格中id,table中第一行 第一列
alert("宽度为:" + testLength);
$('.test1').css('width', testLength*5 + 'px')//点表类,#表id 动态设置input框长度
}
下一篇:H3C telnet配置