阮一峰的IT笔记:首页 -> 分类 -> Javascript 查看所有文章:按分类 | 按月份

IE的DOM兼容性解决方法

1.

将<tr>元素增加到表的<tbody>元素中,而不是直接增加到<table>元素中。

2.

IE不能使用setAttribute正确设置Class属性。解决方法是可以同时使用setAttribute("class","newClassname")和setAttribute("className","newClassName")。

3.

IE中不能使用setAttribute设置style属性,<element>.setAttribute("style","font-weight:bold;")在IE中无效,可以改用<element>.style.cssText="font-weight:bold;"。

« 动态创建内容的DOM方法 | 首页 | DOM动态创建内容示例 »

About

This page contains a single entry from the blog posted on 2007年05月06日 21:27.

The previous post in this blog was 动态创建内容的DOM方法.

The next post in this blog is DOM动态创建内容示例.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33

Post a comment