给高度赋值问题
<html>
<body>
<SCRIPT language="JavaScript">
function testtt(obj)
{
if(obj.tagName!='TR')
{
testtt(obj.parentNode);
}
else
{
return obj.height;
}
}
function tes111(obj)
{
var hh=testtt(obj);
obj.height=hh;
}
</SCRIPT>
<table>
<tr height=38 style='mso-height-source:userset;height:28.5pt'>
<td height=38 colspan=2 style='height:28.5pt;mso-ignore:colspan'></td>
<td></td>
<td colspan=3 class=xl76 style='border-right:.5pt solid black'>方法</td>
<td colspan=7 class=xl78 style='border-right:.5pt solid black;border-left:none'><span id="xm" name="xm">
<img id='img' width=100% src='xx.bmp' onload=tes111(this)></span></td>
</tr>
</table>
</body>
</html>
通过获取上层tr的高度,给img赋高度的值,否则img会拉伸,请问是否能实现。
为什么onload=tes111(this)执行后返回的是‘undefined’