The setup:
I have a suckerdiv menu with links that call a function. Said function looks like:
function F(string)
{
var s = '';
var c = '';
var t = '';
if(string == 'cat')
{
s = "cat";
c = "animal";
t = "fluffy";
}
// ...
document.getElementById("title").innerHTML = t;
document.getElementByID("category").innerHTML = c;
document.getElementByID("description").innerHTML = s;
}
works fine. however, in the actual implementation, the description variable has a little bit of HTML in it, and it seems to be throwing IE off. firefox treats it just fine, but if I have, say,
c = 'Stuff<br><ul><li>listed stuff</li><li>more listed stuff</li><li>some more listed stuff</li></ul><br>bla bla<br>bla';
then IE throws an Unknown Runtime Error and dies when I click that particular link.
the three IDs above are divs that are nested in a table like so:
<table border=1>
<tr><td><div id="title"></div></td></tr>
<tr><td><div id="category"></div></td></tr>
<tr><td><div id="description"></div></td></tr>
</table>
I know that tables by themselves are read-only in IE, but I also know that TDs aren't. the title and category both work fine, so I figured it had something to do with the html in that string. Is there some part of it that I should be escaping? I tried filling it with html-escape codes like < etc, but then it just didn't evaluate the HTML and I was left with a bunch of ugly text.
Any ideas?