js文档碎片(提高文档运行效率)的实例化运用

<!DOCTYPE html>
<html>
<head>
	<title>文档碎片</title>
</head>
<script type="text/javascript">
	window.onload=function(){
    var Oul = document.getElementById('oul');
    var obj = document.createDocumentFragment();
    for(var i=0 ; i< 1000;i++){
    	var oli = document.createElement('li');
    	obj.appendChild(oli);

    }  Oul.appendChild(obj);
	};
</script>
<body>
<ul id="oul">
	
	<li></li>
</ul>
</body>
</html>
发布了62 篇原创文章 · 获赞 102 · 访问量 3155

猜你喜欢

转载自blog.csdn.net/weixin_44763595/article/details/104826698