IE only show the first line after set innerHTML.

G

Guest

I have develop a on-line dictionary website, http://www.stardict.org
I meet a problem:
Here is two lines of js codes:
document.getElementById("wordlist").innerHTML = "";
document.getElementById("definition").innerHTML = "line1<br>line2";
The corresponding html codes are:
<table width="100%">
<tr>
<td width="25%" valign="top"><div id="wordlist" width="100%" style='
overflow-y:auto; height:352px;'></div></td>
<td width="8" bgcolor="#888888"></td>
<td width="75%" valign="top"><div id="definition" width="100%" style='
overflow-y:auto; height:352px;'></div></td>
</tr>
</table>
But I will find only the first line1 is showed, you can't see line2. By
alert(document.getElementById("definition").innerHTML) you can find the
content is right. If comment the first line which set wordlist's
innerHTML, the result will be shown correctly.
This problem only happen in IE. It is correct in firefox. Is this IE6's bug?
Any one can help me to fix the problem? Thanks!
 
R

Rob ^_^

Ne Ho Hu,

I am only guessing as I could not find the page on your web site to test the
code and I am too lazy/busy to set up a sandbox from your code snippet.

Things to try/test -

1. Replace
document.getElementById("wordlist").innerHTML = "";
with

document.getElementById("wordlist").innerHTML = " ";
or
document.getElementById("wordlist").innerHTML = "&nbsp;";

I don't think this is an IE6 bug, perhaps a feature. Some jelly always falls
off the tree when you use a nail and hammer to try and make it stick.
You should perhaps also test your site not only with IE6, but IE6 SP1, IE6
SP2 and IE7 - all are slightly different beasts.

I hope my suggestions work for you.

Regards.
 

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

Top