Hi webmasters,
I have an .asp page on which you can change the background picture of a cell by simply selecting the desired color from a dropdown field.
When running the page in Firefox its Error console tells me the following:
Error: document.getElementById.bgtd is undefined
Source File: http
://localhost/process.asp
Line: 29
<select name=ADDITIONALINFO1 ID="Select1" onchange="changebg(document.forms[0].ADDITIONALINFO1[document.forms[0].ADDITIONALINFO1.selectedIndex].value)">
<option value="White"> White
<option value="Black"> Black
<option value="Blue"> Blue
</select>
And here is the changebg script:
function changebg(color){
if (color=="Black")
document.getElementById("bgtd").background = "img/bg-tshirt5.jpg";
else if (color=="Blue")
document.getElementById("bgtd").background = "img/bg-tshirt_bl.jpg";
else
document.getElementById("bgtd").background = "img/bg-tshirt2.jpg";
document.forms[0].bgimg.value = document.getElementById("bgtd").background;
}
Here is the table where the image is displayed as bachground:
<td width="353" background="Webimages/BGS/bg-tshirt2.jpg" height="269" id="
bgtd">
<p align="center"><font size="1"> <br>
<img src="<%=imgSrc%>"></font></td>
Internet Explorer does not complain and does the job without any errors.
I Could not find out how to make it work also with Firefox.
Any comments are appreciated.
[edited by: Fotiman at 8:14 pm (utc) on Apr 21, 2010]
[edit reason] Unlinked localhost [/edit]