var table = objj.getElementsByTagName(‘table‘);
alert(table[i].width);
if(table==null) return;
for(var i=0; i<table.length; i++) {
if(table[i].width>parseInt(objj.style.width))
{
table[i].style.width = objj.style.width;
}
}
注:table[i].width为整形,table[i].style.width为字符串。例:alert(table[i].width)输出300, alert(table[i].style.width)输出‘300px‘
js 控制 table style css
时间: 2024-10-22 02:30:44