zoukankan      html  css  js  c++  java
  • 预先加载图片

    打开页面的同时加载调用MM_preloadImages()函数
    改函数为初始化函数,preloadImages是预先下载images文件夹中的t240.jpg这张图片
    在网页中一般所用到的装饰图片太多时,有人会用此方法让网页预先下载某些图片
    增加网页显示速度

    <SCRIPT type=text/JavaScript>
    <!--
    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    //-->
    </SCRIPT>

    <body onLoad="MM_preloadImages('http://mall.xom.com/jc/images/jc_tc/dh_1_0.jpg','http://mall.xom.com/jc/images/jc_tc/dh_3_0.jpg','http://mall.xom.com/jc/images/jc_tc/dh_4_0.jpg','http://mall.xom.com/jc/images/jc_tc/dh_5_0.jpg','http://mall.xom.com/jc/images/jc_tc/dh_6_0.jpg')">  

    感谢:jude_lau 

  • 相关阅读:
    203. Remove Linked List Elements
    86. Partition List
    143. Reorder List
    876. Middle of the Linked List
    246. Strobogrammatic Number
    202. Happy Number
    数据类型转换
    表达式
    面向对象
    对齐
  • 原文地址:https://www.cnblogs.com/xred/p/2260318.html
Copyright © 2011-2022 走看看