微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

详解iframe与frame的区别

开门见山了,大家需要注意的地方:HTML5不再支持使用frame,iframe只有src 属性

优点:

  1.程序调入静态页面比较方便;   2.页面和程序分离;

缺点:

  1.iframe有不好之处:样式/脚本需要额外链入,会增加请求。另外用js防盗链只防得了小偷,防不了大盗。   2.iframe好在能够把原先的网页全部原封不动显示下来,但是如果用在首页,是搜索引擎最讨厌的.那么你的网站即使做的在好,也排不到好的名次!如果是动态网页,用include还好点!但是必须要去除他的<body><a href="https://www.jb51.cc/tag/biaoqian/" target="_blank" class="keywords">标签</a>!   3.框架结构有时会让人感到迷惑,特别是在多个框架中都出现上下、左右滚动条的时候。这些滚动条除了会挤占已经特别有限的<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>空间外,还会分散访问者的留心力。访问者遇到这种<a href="https://www.jb51.cc/tag/zhandian/" target="_blank" class="keywords">站点</a>往往会立刻转身离开。他们会想,既然你的主页如此混乱,那么<a href="https://www.jb51.cc/tag/zhandian/" target="_blank" class="keywords">站点</a>的其他部分也许更不值得阅读。(这里面本人的观点就是子框架不要出现滚动条,窗口的滚动条只能有由主<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>来控制)   4.<a href="https://www.jb51.cc/tag/lianjie/" target="_blank" class="keywords">链接</a>导航疑问。运用框架结构时,你必须保证正确配置所有的导航<a href="https://www.jb51.cc/tag/lianjie/" target="_blank" class="keywords">链接</a>,如不然,会给访问者带来很大的麻烦。比如被<a href="https://www.jb51.cc/tag/lianjie/" target="_blank" class="keywords">链接</a>的<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>出现在导航框架内,这种情况下访问者便被陷住了,因为此时他没有其他地点可去。   5.<a href="https://www.jb51.cc/tag/diaoyong/" target="_blank" class="keywords">调用</a>外部<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>,需要额外<a href="https://www.jb51.cc/tag/diaoyong/" target="_blank" class="keywords">调用</a>css,给<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>带来额外的请求<a href="https://www.jb51.cc/tag/cishu/" target="_blank" class="keywords">次数</a>;</p> <p><span style="color: #0000ff">二、为什么少用iframe</p> <p>  iframes 提供了<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>简单的方式把<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>网站的<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>嵌入到另<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>网站中。但我们需要慎重的使用iframe。iframe的创建比其它<a href="https://www.jb51.cc/tag/baokuo/" target="_blank" class="keywords">包括</a>scripts和css的 DOM 元素的创建慢了 1-2 个<a href="https://www.jb51.cc/tag/shuliang/" target="_blank" class="keywords">数量</a>级。 </p> <p>  使用 iframe 的<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>一般不会包含太多 iframe,所以创建 DOM 节点所花费的时间不会占很大的比重。但带来一些其它的问题:onload 事件以及连接池(connection pool)。 </p> <p><h3>1.Iframes 阻塞<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>加载</h3> </p> <p>  及时触发 window 的 onload 事件是非常重要的。onload 事件触发使浏览器的 “忙” 指示器停止,告诉<a href="https://www.jb51.cc/tag/yonghu/" target="_blank" class="keywords">用户</a>当前网页已经加载完毕。当 onload 事件加载延迟后,它给<a href="https://www.jb51.cc/tag/yonghu/" target="_blank" class="keywords">用户</a>的感觉就是这个网页非常慢。 </p> <p>  window 的 onload 事件需要在所有 iframe 加载完毕后(包含里面的元素)才会触发。在 Safari 和 Chrome 里,通过 JavaScript 动态设置 iframe 的 SRC 可以避免这种阻塞情况。 </p> <p><h3>2.唯一的连接池</h3> </p> <p>  浏览器只能开少量的连接到web服务器。比较老的浏览器,包含 Internet Explorer 6 & 7 和 Firefox 2,只能对<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>域名(hostname)同时打开两个连接。这个<a href="https://www.jb51.cc/tag/shuliang/" target="_blank" class="keywords">数量</a>的限制在新版本的浏览器中有所提高。Safari 3+ 和 Opera 9+ 可同时对<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>域名打开 4 个连接,Chrome 1+,IE 8 以及 Firefox 3 可以同时打开 6 个。你可以通过这篇<a href="https://www.jb51.cc/tag/wenzhang/" target="_blank" class="keywords">文章</a>查看具体的数据表:Roundup on P<a href="https://www.jb51.cc/tag/ara/" target="_blank" class="keywords">ara</a>llel Connections. </p> <p>  有人可能希望 iframe 会有自己独立的连接池,但不是这样的。绝大部分浏览器,主<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>和其中的 iframe 是共享这些连接的。这意味着 iframe 在加载资源时可能用光了所有的可用连接,从而阻塞了主<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>资源的加载。如果 iframe 中的<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>比主<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>的<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>更重要,这当然是很好的。但通常情况下,iframe 里的<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>是没有主<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>的<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>重要的。这时 iframe 中用光了可用的连接就是不值得的了。一种<a href="https://www.jb51.cc/tag/jiejue/" target="_blank" class="keywords">解决</a>办法是,在主<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>上重要的元素加载完毕后,再动态设置 iframe 的 SRC。 </p> <p>  美国前 10 大网站都使用了 iframe。大部分情况下,他们用它来加载广告。这是可以理解的,也是一种符合逻辑的<a href="https://www.jb51.cc/tag/jiejuefang/" target="_blank" class="keywords">解决方</a>案,用一种简单的办法来加载广告服务。但请记住,iframe 会给你的<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a><a href="https://www.jb51.cc/tag/xingneng/" target="_blank" class="keywords">性能</a>带来冲击。只要可能,不要使用 iframe。当确实需要时,谨慎的使用他们。 </p> <p><span style="color: #0000ff">三、iframe和frame的区别 </p> <p>1、frame不能脱离frameSet单独使用,iframe可以; 2、frame不能放在body中; </p> <p>如下可以正常<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>: </p> <div class="jb51code"> <pre class="b<a href="https://www.jb51.cc/tag/rush/" target="_blank" class="keywords">rush</a>:js;"> <!--<body>--> <frameset rows="50%,*"> <frame name="frame1" src="http://gongxquan.blog.163.com/test1.htm"/> <frame name="frame2" src="http://gongxquan.blog.163.com/test2.htm"/> </frameset> <!--<body>--> </pre> </div> <p>  如下不能正常<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>: </p> <div class="jb51code"> <pre class="b<a href="https://www.jb51.cc/tag/rush/" target="_blank" class="keywords">rush</a>:js;"> <body> <frameset rows="50%,*"> <frame name="frame1" src="http://gongxquan.blog.163.com/test1.htm"/> <frame name="frame2" src="http://gongxquan.blog.163.com/test2.htm"/> </frameset> <body> </pre> </div> <p>3、嵌套在frameSet中的iframe必需放在body中; 如下可以正常<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>: </p> <div class="jb51code"> <pre class="b<a href="https://www.jb51.cc/tag/rush/" target="_blank" class="keywords">rush</a>:js;"> <body> <frameset> <iframe name="frame1" src="http://gongxquan.blog.163.com/test1.htm"/> <iframe name="frame2" src="http://gongxquan.blog.163.com/test2.htm"/> </frameset> </body> </pre> </div> <p>如下不能正常<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>: </p> <div class="jb51code"> <pre class="b<a href="https://www.jb51.cc/tag/rush/" target="_blank" class="keywords">rush</a>:js;"> <!--<body>--> <frameset> <iframe name="frame1" src="http://gongxquan.blog.163.com/test1.htm"/> <iframe name="frame2" src="http://gongxquan.blog.163.com/test2.htm"/> </frameset> <!--</body>--> </pre> </div> <p>4、不嵌套在frameSet中的iframe可以随意使用; </p> <p>如下均可以正常<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>: </p> <div class="jb51code"> <pre class="b<a href="https://www.jb51.cc/tag/rush/" target="_blank" class="keywords">rush</a>:js;"> <body> <iframe name="frame1" src="http://gongxquan.blog.163.com/test1.htm"/> <iframe name="frame2" src="http://gongxquan.blog.163.com/test2.htm"/> </body> <!--<body>--> <iframe name="frame1" src="http://gongxquan.blog.163.com/test1.htm"/> <iframe name="frame2" src="http://gongxquan.blog.163.com/test2.htm"/> <!--</body>--> </pre> </div> <p>5、frame的高度只能通过frameSet控制;iframe可以自己控制,不能通过frameSet控制,如: </p> <div class="jb51code"> <pre class="b<a href="https://www.jb51.cc/tag/rush/" target="_blank" class="keywords">rush</a>:js;"> <!--<body>--> <frameset rows="50%,*"> <frame name="frame1" src="http://gongxquan.blog.163.com/test1.htm"/> <frame name="frame2" src="http://gongxquan.blog.163.com/test2.htm"/> </frameset> <!--</body>--> <body> <frameset> <iframe height="30%" name="frame1" src="http://gongxquan.blog.163.com/test1.htm"/> <iframe height="100" name="frame2" src="http://gongxquan.blog.163.com/test2.htm"/> </frameset> </body> </pre> </div> <p>6、如果在同<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a><a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>使用了两个以上的iframe,在IE中可以正常<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>,在firefox中只能<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>出第<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>(firefox已经改进,这个问题已经不存在了);使用两个以上的frame在IE和firefox中均可正常</p> <p><h3>小结:</h3> </p> <p>Frame与Iframe两者可以实现的<a href="https://www.jb51.cc/tag/gongneng/" target="_blank" class="keywords">功能</a>基本相同,不过Iframe比Frame具有更多的灵活性。 frame是整个<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>的框架,iframe是内嵌的网页元素,也可以说是内嵌的框架 Iframe<a href="https://www.jb51.cc/tag/biaoji/" target="_blank" class="keywords">标记</a>又叫浮动帧<a href="https://www.jb51.cc/tag/biaoji/" target="_blank" class="keywords">标记</a>,可以用它将<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>HTML文档嵌入在<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>HTML中<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>。它和Frame<a href="https://www.jb51.cc/tag/biaoji/" target="_blank" class="keywords">标记</a>的最大区别是在网页中嵌入 的<Iframe></Iframe>所包含的<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>与整个<a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>是<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>整体,而<Frame>< /Frame>所包含的<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>是<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>独立的个体,是可以独立<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>的。另外,应用Iframe还可以在同<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a><a href="https://www.jb51.cc/tag/yemian/" target="_blank" class="keywords">页面</a>中多次<a href="https://www.jb51.cc/tag/xianshi/" target="_blank" class="keywords">显示</a>同一<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>,而不必重复这段内 容的<a href="https://www.jb51.cc/tag/daima/" target="_blank" class="keywords">代码</a>。</p><ins class="adsbygoogle" style="display:inline-block;width:780px;height:90px" data-ad-client="ca-pub-4605373693034661" data-ad-slot="4286417769"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><p class="small text-muted">版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。</p> </div><div class="topcard-tags"><a href="https://www.jb51.cc/tag/iframeyuframedequbie/" class="tag_link" target="_blank">iframe与frame的区别</a></div><ul class="list-group"> <li class="list-group-item"><a href="https://www.jb51.cc/js/50586.html" title="浅析JavaScript中的变量复制、参数传递和作用域链">上一篇:浅析JavaScript中的变量复制、参数</a><a href="https://www.jb51.cc/js/50583.html" title="简单的JS时钟实例讲解" class="text-muted pull-right">下一篇:简单的JS时钟实例讲解</a> </li> </ul> </div> </div> </div> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <h4>相关推荐</h4> <hr /> <div class="list_con"> <a href="https://www.jb51.cc/js/4742335.html" title="自定义web弹窗/层:简易风格的msg与可拖放的dialog,生成博客园文章目录弹窗"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/879e7ec08a36083a57dfc8b44214469d.gif" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">自定义web弹窗/层:简易风格的msg与可拖放的dialog,生成博客园文章目录弹窗</div> <div class="summary">前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为layUI的一个重要组件,使用简单、接口参数丰富,功能健壮,深受广大开发者的喜爱,作为一个热(经)爱(常)工(划)作(水),喜欢钻研探索技术的程序员(狗),我们自己来实现一个web弹窗/层,一窥layer的本源(/手动滑稽脸),进步,从</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742334.html" title="nice-validator表单验证插件的简单使用"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/84bd76d88488cafdfb2789b5a991fecf.png" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">nice-validator表单验证插件的简单使用</div> <div class="summary">前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步,是数据安全的第一道关卡,虽然我们不能100%相信客户端提交的数据(真正的校验还得在服务端进行),但设置前端表单校验也是至关重要的,自己写逻辑代码一个一个表单字段去校验不现实,又不想自己造轮子,使用jquery插件是不错的选择,这里记录一下在</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742333.html" title="基于“formData批量上传的多种实现” 的多图片预览、上传的多种实现"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/cf659cff914621d918c6072273c30973.gif" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">基于“formData批量上传的多种实现” 的多图片预览、上传的多种实现</div> <div class="summary">前言 图片上传是web项目常见的需求,我基于之前的博客的代码(请戳:formData批量上传的多种实现)里的第三种方法实现多图片的预览、上传,并且支持三种方式添加图片到上传列表:选择图片、复制粘贴图片、鼠标拖拽图片,同时支持从上传列表中移除图片(点击“X”号) 效果演示 选择图片 页面操作 后台接参</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742332.html" title="踹掉后端,前端导出Excel!"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/02f80db4fdf55f3a24674e2854e018f2.png" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">踹掉后端,前端导出Excel!</div> <div class="summary">前言 导出Excel文件这个功能,通常都是在后端实现返回前端一个下载链接,但有时候我们只想导出前端页面上已经有了的数据,不想再调后端导出接口浪费服务器资源,学习本文demo例子,我们踹掉后端,直接在前端导出Excel! 代码实现 1、利用Blob对象构造一个a标签的href链接,从而实现文件下载,E</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742331.html" title="Web Worker——js的多线程,实现统计博客园总阅读量、总评论量、总推荐量"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/db8dce1453ed09a8230451f2a9fcdc68.png" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">Web Worker——js的多线程,实现统计博客园总阅读量、总评论量、总推荐量</div> <div class="summary">前言 众所周知,js是单线程的,从上往下,从左往右依次执行,当我们有耗时的任务需要处理时,便会阻塞线程造成页面卡顿等问题。web worker的目的,就是为JavaScript创造多线程环境,允许主线程将一些任务分配给子线程。在主线程运行的同时,子线程在后台运行,两者互不干扰。等到子线程完成计算任务</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742330.html" title="select标签 禁止选择但又能通过序列化form表单传值到后台"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/1cd1c972ce822d1a99b7d1b2c8f9cfcd.png" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">select标签 禁止选择但又能通过序列化form表单传值到后台</div> <div class="summary">前言 项目开发中,我们可能会碰到这样的需求:select标签,禁止选择但又能通过序列化form表单传值到后台,但是当我们使用disabled=&quot;disabled&quot;时发现,无法序列化form获取到select标签的值;当我们使用readonly=&quot;readonly&quo</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742329.html" title="还在问跨域?本文记录js跨域的多种实现实例"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/b3d33681769f85a34baa6f533017a87e.png" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">还在问跨域?本文记录js跨域的多种实现实例</div> <div class="summary">前言 众所周知,受浏览器同源策略的影响,产生了跨域问题,那么我们应该如何实现跨域呢?本文记录几种跨域的简单实现 前期准备 为了方便测试,我们启动两个服务,10086(就是在这篇博客自动生成的项目,请戳:SpringBoot系列——Spring-Data-JPA(究极进化版) 自动生成单表基础增、删、</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742328.html" title="formData批量上传的多种实现"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/f653266552cf5647e3a76ba22e73dece.png" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">formData批量上传的多种实现</div> <div class="summary">前言 最近项目需要批量上传附件,查了下资料,网上很多但看着一脸懵,只贴部分代码,介绍也不详细,这里记录一下自己的采坑与多种实现,以免以后忘记。 这里先介绍下FormData对象,以下内容摘自:https://developer.mozilla.org/zh-CN/docs/Web/API/FormD</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742327.html" title="laypage 物理分页与逻辑分页实例"><img class="lazy" src="https://www.jb51.cc/images/np.jpg" data-original="https://www.jb51.cc/res/2024/09-25/18/132e831d786a4bdd438d96a8d4cc755e.png" title="" width="160" height="90" style="float:right;margin-left:30px;" /><div class="title">laypage 物理分页与逻辑分页实例</div> <div class="summary">前言 以下介绍摘自&#160;layui官网laypage layPage 致力于提供极致的分页逻辑,既可轻松胜任异步分页,也可作为页面刷新式分页。自 layui 2.0 开始,无论是从核心代码还是API设计,layPage 都完成了一次蜕变。清爽的UI、灵活的排版,极简的调用方式,这一切的优质元素</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div><div class="list_con"> <a href="https://www.jb51.cc/js/4742326.html" title="乐观锁机制解决多层嵌套异步ajax问题"><div class="title">乐观锁机制解决多层嵌套异步ajax问题</div> <div class="summary">前言 在项目中我们通常需要使用ajax异步嵌套去请求数据并做数据的展示,当我们多次快速的多次的发起ajax,因为ajax是异步的,每个ajax触发回调的时间都是不可控的,这样就会造成前面发起的ajax跟后面发起的ajax都有可能去修改同一个DOM,导致展示的数据顺序错乱或数据重复,我们希望DOM展示</div> <time class="summary">作者:huanzi-qch 时间:2024-09-25</time> </a> </div></div> </div> </div> </div> <div class="col-sm-12 col-md-12 col-lg-3"> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <!-- jb51-article-300x600 --> <ins class="adsbygoogle" style="display:inline-block;width:300px;height:600px" data-ad-client="ca-pub-4605373693034661" data-ad-slot="7541177540"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card" style="padding:20px;"> <label class="main-content-label ">小编推荐</label><div class="entry-img"><img src="https://www.jb51.cc/res/2023/06-29/12/fa513c17761076a6649593e2bd17f268.jpg" height="150" width="100%"><div class="entry-wrap"><a href="https://www.jb51.cc/mp/4606010.html" title="苹果市值2025年有望达4万亿美元" >苹果市值2025年有望达4万亿美元</a> </div></div><ul class="n-list"><li><a href="https://www.jb51.cc/mp/4742234.html" title="微信青少年模式全新升级:视频号内容分级与家长控制功能上线!" >• 微信青少年模式全新升级:视频号内容分</a></li><li><a href="https://www.jb51.cc/mp/4742229.html" title="《地下城与勇士DNF》永久交通卡卡面上线华为钱包!" >• 《地下城与勇士DNF》永久交通卡卡面上线</a></li><li><a href="https://www.jb51.cc/mp/4742227.html" title="优酷为方便长辈看视频,上线银发剧场!" >• 优酷为方便长辈看视频,上线银发剧场!</a></li><li><a href="https://www.jb51.cc/mp/4742224.html" title="微信读书集成腾讯混元AI技术,可以一日阅读千页?" >• 微信读书集成腾讯混元AI技术,可以一日</a></li><li><a href="https://www.jb51.cc/mp/4742221.html" title="京东快递上线11项会员权益" >• 京东快递上线11项会员权益</a></li><li><a href="https://www.jb51.cc/mp/4742219.html" title="高德地图功能升级,新增安全预警" >• 高德地图功能升级,新增安全预警</a></li><li><a href="https://www.jb51.cc/mp/4742214.html" title="小爱同学多模态能力升级,引领智能生活新潮流" >• 小爱同学多模态能力升级,引领智能生活</a></li></ul> </div> </div> </div> <!-- row end --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <label class="main-content-label ">热门标签<a href="https://www.jb51.cc/all" class="pull-right">更多</a> </label> <div class="topcard-tags"><a href="https://www.jb51.cc/tag/python/" title="python">python</a><a href="https://www.jb51.cc/tag/JavaScript/" title="JavaScript">JavaScript</a><a href="https://www.jb51.cc/tag/java/" title="java">java</a><a href="https://www.jb51.cc/tag/HTML/" title="HTML">HTML</a><a href="https://www.jb51.cc/tag/PHP/" title="PHP">PHP</a><a href="https://www.jb51.cc/tag/reactjs/" title="reactjs">reactjs</a><a href="https://www.jb51.cc/tag/C/" title="C#">C#</a><a href="https://www.jb51.cc/tag/Android/" title="Android">Android</a><a href="https://www.jb51.cc/tag/CSS/" title="CSS">CSS</a><a href="https://www.jb51.cc/tag/Nodejs/" title="Node.js">Node.js</a><a href="https://www.jb51.cc/tag/sql/" title="sql">sql</a><a href="https://www.jb51.cc/tag/rp/" title="r">r</a><a href="https://www.jb51.cc/tag/python3x/" title="python-3.x">python-3.x</a><a href="https://www.jb51.cc/tag/MysqL/" title="MysqL">MysqL</a><a href="https://www.jb51.cc/tag/jQuery/" title="jQuery">jQuery</a><a href="https://www.jb51.cc/tag/c4343/" title="c++">c++</a><a href="https://www.jb51.cc/tag/pandas/" title="pandas">pandas</a><a href="https://www.jb51.cc/tag/flutter/" title="Flutter">Flutter</a><a href="https://www.jb51.cc/tag/angular/" title="angular">angular</a><a href="https://www.jb51.cc/tag/IOS/" title="IOS">IOS</a><a href="https://www.jb51.cc/tag/django/" title="django">django</a><a href="https://www.jb51.cc/tag/linux/" title="linux">linux</a><a href="https://www.jb51.cc/tag/swift/" title="swift">swift</a><a href="https://www.jb51.cc/tag/typescript/" title="typescript">typescript</a><a href="https://www.jb51.cc/tag/luyouqi/" title="路由器">路由器</a><a href="https://www.jb51.cc/tag/JSON/" title="JSON">JSON</a><a href="https://www.jb51.cc/tag/luyouqishezhi/" title="路由器设置">路由器设置</a><a href="https://www.jb51.cc/tag/wuxianluyouqi/" title="无线路由器">无线路由器</a><a href="https://www.jb51.cc/tag/h3c/" title="h3c">h3c</a><a href="https://www.jb51.cc/tag/huasan/" title="华三">华三</a><a href="https://www.jb51.cc/tag/huasanluyouqishezhi/" title="华三路由器设置">华三路由器设置</a><a href="https://www.jb51.cc/tag/huasanluyouqi/" title="华三路由器">华三路由器</a><a href="https://www.jb51.cc/tag/diannaoruanjianjiaocheng/" title="电脑软件教程">电脑软件教程</a><a href="https://www.jb51.cc/tag/arrays/" title="arrays">arrays</a><a href="https://www.jb51.cc/tag/docker/" title="docker">docker</a><a href="https://www.jb51.cc/tag/ruanjiantuwenjiaocheng/" title="软件图文教程">软件图文教程</a><a href="https://www.jb51.cc/tag/C/" title="C">C</a><a href="https://www.jb51.cc/tag/vuejs/" title="vue.js">vue.js</a><a href="https://www.jb51.cc/tag/laravel/" title="laravel">laravel</a><a href="https://www.jb51.cc/tag/springboot/" title="spring-boot">spring-boot</a></div> </div> </div> </div> </div> </div> </div> <footer id="footer"> <div class="container" style="width:1440px;"> <div class="row hidden-xs"> <div class="col-sm-12 col-md-9 col-lg-9 site-link"> <ul class="list-inline"> <li>友情链接:</li><li><a href="https://ai.jb51.cc/" title="ai导航是编程之家旗下ai方向的ai资讯、ai工具类集合导航站。" target="_blank" rel="nofollow">ai导航</a></li></ul> <ul class="list-inline"> <li><a href="https://www.jb51.cc" title="编程之家">编程之家</a></li>-<li><a href="https://t5m44pq3f7.jiandaoyun.com/f/638ca61b7b079a000a5d2dd6" rel="nofollow" title="我要投稿" target="_blank">我要投稿</a></li>-<li><a target="_blank" rel="nofollow" href="https://t5m44pq3f7.jiandaoyun.com/f/638ca8c69ad234000a79561f" title="广告合作">广告合作</a></li>-<li><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=76874919&site=qq&menu=yes">联系我们</a></li>-<li><a href="https://www.jb51.cc/disclaimers.html" title="免责声明">免责声明</a></li>-<li><a href="https://www.jb51.cc/sitemap/all/index.xml" title="网站地图" target="_blank">网站地图</a></li> </ul> <div>版权所有 © 2018编程之家<a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">闽ICP备13020303号-8</a> </div> </div> <div class="col-sm-12 col-md-3 col-lg-3"><img src="https://www.jb51.cc/qrcode.jpg" width="90" alt="微信公众号搜索 “ 程序精选 ” ,选择关注!"> <div class="pull-right">微信公众号搜<span class="text-danger">"智元新知"</span>关注<br />微信扫一扫可直接关注哦!</div> </div> </div> </div> </footer> <script> (function () { var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bp, s); })(); </script> <script src="https://www.jb51.cc/js/count.js"></script> </body> </html>