<td align="center" background="Images/respon_tframe_m.gif"><a href="#" class="style28" onclick="">工作程序</a></td>
用javascript 能得到td 里面的背景颜色吗??
<td id="cell" align="center" background="Images/respon_tframe_m.gif"><a href="#" class="style28" onclick="">工作程序</a></td>
<script language=javascript>
function getAttribute(ctrId, attributeName) {
var c = document.all(ctrId);
return c.getAttribute(attributeName);
}
alert( getAttribute("cell", "background") );
</script>
function setAttribute(ctrId, attributeName, attributeValue) {
var c = document.all(ctrId);
return c.setAttribute(attributeName, attributeValue, 0);
}
setAttribute("cell", "background", "Images/respon_tframe_m.gif");
本文介绍了一种使用JavaScript获取HTML中TD元素背景图片的方法,并展示了如何通过getAttribute和setAttribute函数实现背景图片的读取与设置。
1344

被折叠的 条评论
为什么被折叠?



