invalid argument in IE, yet everything fine in FireFox, no syntax error reported

L

lkrubner

Look at this page:

http://www.lauradenyes.com/test3.html


It contains this function:


<script type="text/javascript">
function changeBackgroundImageZ (imageToChangeTo) {
var thisDiv = document.getElementById("imageDiv");
var urlInfo = "url('";
urlInfo += imageToChangeTo;
urlInfo += "');";
thisDiv.style.backgroundImage = urlInfo;
}
</script>


IE dies on the final line of this function and it complains that it is
getting an "invalid argument". But FireFox plays this without
complaint, and without any syntax error reported in the FireFox
debugger.
 
J

Jc

<script type="text/javascript">
function changeBackgroundImageZ (imageToChangeTo) {
var thisDiv = document.getElementById("imageDiv");
var urlInfo = "url('";
urlInfo += imageToChangeTo;
urlInfo += "');";
thisDiv.style.backgroundImage = urlInfo;
}
</script>


IE dies on the final line of this function and it complains that it is
getting an "invalid argument". But FireFox plays this without
complaint, and without any syntax error reported in the FireFox
debugger.

IE doesn't like the semicolon after the closing parentheses. Here's an
example from
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/backgroundimage.asp:

this.style.backgroundImage='url(sphere.jpeg)'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top