当前位置: 首页 > 图文教程 > 网络编程 > Javascript > javascript之解决IE下不渲染的bug

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 javascript之解决IE下不渲染的bug


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 93 ::
收藏到网摘: n/a

有时候,你会发现,在一些JS应用中,涉及到CSS的重新渲染(即页面样式需要更新)的话,IE死活不变。
此时你需要让IE重新渲染一下:

function handleIEhasLayout(){
//trigger re-rendering
document.body.style.zoom = 1.1;
//restore it
document.body.style.zoom = '';
}

有问题,记得执行一下handleIEhasLayout,万事OK。
原文:http://realazy.org/blog/2007/04/02/ie-haslayout-rerendering/
引用
IE5 似乎没有这个问题,IE6 有,我的 IE7 还是 beta2,版本号是 7.0.5346.5,也没有这个问题,一个朋友用的 beta3 版本号是 7.0.5450.4 居然说也有问题,我没有测试,用这个版本 IE 的朋友可以帮忙看看。

Dnew.cn 注:用这段代码似乎更好一些:
function reflow(){
var b = document.body;
b.style.zoom = b.style.zoom=="1"?"100%":"1";
}

使用style.zoom在某些情况下还会出现不能全部渲染的问题,比如页面内容很少,没有占满屏幕。
(shiweiwei97)的方法是:
document.body.style.display = “none”;
document.body.style.display = “”;