innerHTML in IE?

本秂侑毒 提交于 2019-12-01 13:55:31

firstly, pretty sure a DIV directly inside a TABLE is illegal markup.

don't use illegal markup. browsers will respond differently to it (i've recently had Opera ignore some illegal stuff with IE trying to render it).

tho IE usually deserves it, firstly get the markup correct and then see how IE does. it may be that it has failed to render the DOM how you expect.

(FWIW there is an innerHTML rendering problem i've run up against with IE, http://support.microsoft.com/kb/276228/, but for the SELECT element so i don't think it applies here).

The issue was indeed innerHTML on table tag. IE doesn't support innerHTML wrapped around a table tag nor they intend to resolve this issue in their future releases.

The workaround is to either use DOM methods or the easiest way: wrap your table around a div.

So I ended up with:

<div id="js" align="center"><table>
        <span class='main'>
            <a onClick="getVote(this.value, this.size);" type="radio" value="0" size="<?php echo $row['id']; ?>" /><img src="arrowup.png"/></a>
            <br /><a onClick="getVote(this.value, this.size);" type="radio" value="1" size="<?php echo $row['id']; ?>" /><img src="arrowdown.png"/></a>
            </span>
</table></div>

There's another IE bug that screws up the label if they're set to be image. Just a heads up! I know you won't be surprised when I say IE sucks!

I know this is a little late but here is how to fix this issue with jQuery:

$("#tableName").html(DataToWrite);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!