zoukankan      html  css  js  c++  java
  • js 按需加载

    一、通过点击事件加载代码

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>模版形式---按需加载</title>
    </head>
    <body>
    <script type="text/x-template" id="suc_subscription">
    	<div>
    		<img src="image address">
    	</div>
    </script>
    <div id="success_dialog"></div>
    <input type="button" value="load" onclick="showHtml();">
    
    <script type="text/javascript">
    	function showHtml(){
    		document.getElementById('success_dialog').innerHTML = document.getElementById('suc_subscription').innerHTML;
    	}
    </script>
    </body>
    </html>
    

      二、懒惰加载--当滚动条拉动到某个位置时,即将进入可视范围的图片需要加载

      三、

    内容来自:http://tid.tenpay.com/?p=4085&ptlang=2052&ADUIN=731638471&ADSESSION=1440982512&ADTAG=CLIENT.QQ.5431_.0&ADPUBNO=26510

  • 相关阅读:
    $NOIP2012$ 题解报告
    $NOIP2011$ 题解报告
    $NOIP2007$ 题解报告
    $NOIP2006$ 题解报告
    $NOIP2005$ 题解报告
    $NOIP2003$ 题解报告
    $NOIP2002$ 题解报告
    $NOIP2001$ 题解报告
    $NOIP2000$ 题解报告
    $NOIP1999$ 题解报告
  • 原文地址:https://www.cnblogs.com/binbang/p/4773358.html
Copyright © 2011-2022 走看看