JamesEggers
JamesEggers

Reputation: 12936

innerHTML Isn't working in Firefox and IE

I have a feeling that I'm missing something simple here but can't seem to find it.

I'm using SwfUpload and on its uploadSuccess() event, I'm showing a "success" message on the screen while hiding the progress image. Below is the snippet:

swfu.uploadSuccess = function(file, serverData, response) {
    document.getElementById("progressImg").display = "none";

    var uploadMessage = document.getElementById("UploadMessage");
    uploadMessage.style.display = "block";
    uploadMessage.innerHTML("The file, " + file.name + ", was uploaded successfully.");                 
};

Everything works fine up until the last line when I'm attempting to set the text of the uploadMessage object. The object refers to a <span> tag though I've also tried it as a <div> just in case. IE8 says that innerHTML is not supported and FF3.5.4 doesn't show any errors (haven't added firebug yet). I've also tried to just put set static text instead of a concatenated string to no avail either.

This is a trivial task that I've done countless times w/ and w/o a framework; however, it's not working at this time. What am I missing?

Thanks

EDIT:

Since someone may wonder, current doctype is set to HTML 4.0 Transitional.

Upvotes: 1

Views: 251

Answers (3)

vaske
vaske

Reputation: 9552

Try this one uploadMessage.innerHTML = "The file, " + file.name + ", was uploaded successfully.";

Upvotes: 0

JohnC
JohnC

Reputation: 340

innerHTML is a property, not a method, that's it :)

So uploadMessage.innerHTML = "...";

Upvotes: 1

Pavel Minaev
Pavel Minaev

Reputation: 101665

It's a property:

 uploadMessage.innerHTML = "...";

On a side note, have you considered what happens if name of file contains an ampersand?

Upvotes: 7

Related Questions