itsjareds
07-05-2008, 12:47 AM
Hi, i need to write a script that finds the background image of a table column (<td>).
This is the script I currently have:
var background = document.getElementsByTagName('table')[1].background.src;
..and this is the HTML that I am trying to change:
<body>
<table>
<tr>
<td>
<table background="this is what i want.jpg">
When I run the script, the error console says:
document.getElementsByTagName("table")[1].background is undefined
Does anyone know why this doesn't work?
This is the script I currently have:
var background = document.getElementsByTagName('table')[1].background.src;
..and this is the HTML that I am trying to change:
<body>
<table>
<tr>
<td>
<table background="this is what i want.jpg">
When I run the script, the error console says:
document.getElementsByTagName("table")[1].background is undefined
Does anyone know why this doesn't work?