方法一:写在JS文件中
方法二:写在html中
方法三:写在css中
写在CSS中效率会比较低
if ($.browser.msie && parseInt($.browser.version, 10) < 7) {
try {
document.execCommand("BackgroundImageCache", false, true)
} catch (e) {
}
}
方法二:写在html中
<!--[if IE 6]>
<script type="text/javascript">
//<![CDATA[
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(e) {}
//]]>
</script>
<![endif]-->
方法三:写在css中
html {
filter:expression(document.execCommand("BackgroundImageCache",false,true));
}
写在CSS中效率会比较低

本文介绍了三种优化网页加载速度的方法,包括在JS文件中使用if语句、在HTML中使用条件注释以及在CSS中应用表达式。通过对比效率,揭示了每种方法的优缺点。
139

被折叠的 条评论
为什么被折叠?



