PDA

View Full Version : Changing Table Background w/ links



Tombo
Jun 23rd, 2002, 10:40 PM
Hullo,

Just looking for a simple script, I want to have 4 links that, when clicked, will change the back ground image of a table. Simple enough... but I don't know how. :P

Thanks.

netfervor
Jun 23rd, 2002, 11:16 PM
Try this,
-----the script
<script>
function chgArrow(i){
document.getElementById('tdImg').setAttribute("background",i);
}
</script>
-----the table
<table>
<tr>
<td><a href="javascript:chgArrow('images/image1.gif')">up</a></td>
<td><a href="javascript:chgArrow('images/image2.gif')">Down</a></td>
<td id="tdImg" background="images/default.gif" nowrap>----content here------</td>
</tr>
</table>

script run for DOM browser only, i try with IE6 and NN6