<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>评论：动态加载js</title>
	<atom:link href="http://www.zhangjingwei.com/archives/asynchronous-loading-js/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/</link>
	<description></description>
	<lastBuildDate>Sat, 07 Jan 2012 13:58:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>来自：ayen</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-3154</link>
		<dc:creator>ayen</dc:creator>
		<pubDate>Wed, 17 Aug 2011 03:24:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-3154</guid>
		<description>可以考虑使用递归加载的方式</description>
		<content:encoded><![CDATA[<p>可以考虑使用递归加载的方式</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：小兴</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-2747</link>
		<dc:creator>小兴</dc:creator>
		<pubDate>Thu, 24 Feb 2011 09:55:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-2747</guid>
		<description>可以将JS放在最后加载，可以解决阻塞图片加载的问题，但是也要根据具体情况来决定相应的做法</description>
		<content:encoded><![CDATA[<p>可以将JS放在最后加载，可以解决阻塞图片加载的问题，但是也要根据具体情况来决定相应的做法</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：张经纬</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-2475</link>
		<dc:creator>张经纬</dc:creator>
		<pubDate>Tue, 19 Oct 2010 03:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-2475</guid>
		<description>载入js不存在跨域这个问题啊，你引入哪里的js都是可以的。

本文是调用xmlhttprequest对象来加载，只是一种思路。

在实际使用中，其实只要将js路径写入到script标签里即可。

你说的跨域问题，采用直接写入的方式就不会出现了，而且即便使用xmhttprequest对象，也可以用php中转等等方法解决。</description>
		<content:encoded><![CDATA[<p>载入js不存在跨域这个问题啊，你引入哪里的js都是可以的。</p>
<p>本文是调用xmlhttprequest对象来加载，只是一种思路。</p>
<p>在实际使用中，其实只要将js路径写入到script标签里即可。</p>
<p>你说的跨域问题，采用直接写入的方式就不会出现了，而且即便使用xmhttprequest对象，也可以用php中转等等方法解决。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：xiaomao</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-2474</link>
		<dc:creator>xiaomao</dc:creator>
		<pubDate>Tue, 19 Oct 2010 01:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-2474</guid>
		<description>如果是跨域的js文件呢，你这么加载，显示：没有权限</description>
		<content:encoded><![CDATA[<p>如果是跨域的js文件呢，你这么加载，显示：没有权限</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：张经纬</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-611</link>
		<dc:creator>张经纬</dc:creator>
		<pubDate>Mon, 31 Aug 2009 01:13:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-611</guid>
		<description>@小毛
....大汗啊。</description>
		<content:encoded><![CDATA[<p>@小毛<br />
&#8230;.大汗啊。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：小毛</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-609</link>
		<dc:creator>小毛</dc:creator>
		<pubDate>Sun, 30 Aug 2009 10:29:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-609</guid>
		<description>这个问题不是你可以考虑的,应该由浏览器开发人员来处理.</description>
		<content:encoded><![CDATA[<p>这个问题不是你可以考虑的,应该由浏览器开发人员来处理.</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：颜小城</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-605</link>
		<dc:creator>颜小城</dc:creator>
		<pubDate>Fri, 28 Aug 2009 10:00:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-605</guid>
		<description>我不懂。</description>
		<content:encoded><![CDATA[<p>我不懂。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：onion83</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-600</link>
		<dc:creator>onion83</dc:creator>
		<pubDate>Thu, 20 Aug 2009 10:06:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-600</guid>
		<description>思路很好,不过写起来有点浪费代码
loadscript.ls(&#039;js1.js&#039;);
loadscript.ls(&#039;js2.js&#039;);
loadscript.ls(&#039;js3.js&#039;);
loadscript.ls(&#039;js4.js&#039;);
loadscript.ls(&#039;js5.js&#039;);
loadscript.ls(&#039;js6.js&#039;);

做成一个干净的接口 loadscript.ls(&#039;js1&#039;,&#039;js2&#039;,&#039;js ....&#039;); 多好

php 有一个叫auto_load的机制，核心的思想是用到的时候再加载.

例如 我调用的函数 package_a() ;能不能不考虑不需要加载那个js,反正只管调用.如果package_a() 又调用了 package_b() 那也自动再加载相关的文件.呵呵，这个就上升到一个编程的框架和包管理的级别了~可以多往这个方向思考一下.</description>
		<content:encoded><![CDATA[<p>思路很好,不过写起来有点浪费代码<br />
loadscript.ls(&#8216;js1.js&#8217;);<br />
loadscript.ls(&#8216;js2.js&#8217;);<br />
loadscript.ls(&#8216;js3.js&#8217;);<br />
loadscript.ls(&#8216;js4.js&#8217;);<br />
loadscript.ls(&#8216;js5.js&#8217;);<br />
loadscript.ls(&#8216;js6.js&#8217;);</p>
<p>做成一个干净的接口 loadscript.ls(&#8216;js1&#8242;,&#8217;js2&#8242;,&#8217;js &#8230;.&#8217;); 多好</p>
<p>php 有一个叫auto_load的机制，核心的思想是用到的时候再加载.</p>
<p>例如 我调用的函数 package_a() ;能不能不考虑不需要加载那个js,反正只管调用.如果package_a() 又调用了 package_b() 那也自动再加载相关的文件.呵呵，这个就上升到一个编程的框架和包管理的级别了~可以多往这个方向思考一下.</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：张经纬</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-598</link>
		<dc:creator>张经纬</dc:creator>
		<pubDate>Wed, 19 Aug 2009 01:35:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-598</guid>
		<description>@suntear
css也可以这样，其实这个用了好多年了，加载css我个人觉得没有多大意义，首先css并不会很大，另外css并不会组织并行下载，最后动态载入样式的时候，浏览器要重新渲染页面，其实挺耗费资源的。
不过js就要另外说了。

@Asins
我只是一个demo，抛砖引玉，并不完善，千万不能拿来就用，比如说我没有判断加载的是否重复等等。 :)</description>
		<content:encoded><![CDATA[<p>@suntear<br />
css也可以这样，其实这个用了好多年了，加载css我个人觉得没有多大意义，首先css并不会很大，另外css并不会组织并行下载，最后动态载入样式的时候，浏览器要重新渲染页面，其实挺耗费资源的。<br />
不过js就要另外说了。</p>
<p>@Asins<br />
我只是一个demo，抛砖引玉，并不完善，千万不能拿来就用，比如说我没有判断加载的是否重复等等。 <img src='http://www.zhangjingwei.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：Asins</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-597</link>
		<dc:creator>Asins</dc:creator>
		<pubDate>Tue, 18 Aug 2009 09:57:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-597</guid>
		<description>之前接触过LABjs这个小小的东西，作用就是加载JS文件，很方便，使用方法也比你这个要好些。</description>
		<content:encoded><![CDATA[<p>之前接触过LABjs这个小小的东西，作用就是加载JS文件，很方便，使用方法也比你这个要好些。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：suntear</title>
		<link>http://www.zhangjingwei.com/archives/asynchronous-loading-js/comment-page-1/#comment-596</link>
		<dc:creator>suntear</dc:creator>
		<pubDate>Tue, 18 Aug 2009 02:18:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhangjingwei.com/?p=1112#comment-596</guid>
		<description>这个方法不错！多个css文件岂不是也可以这样了？以前听说过有人在服务器端高贵实现这种效果。</description>
		<content:encoded><![CDATA[<p>这个方法不错！多个css文件岂不是也可以这样了？以前听说过有人在服务器端高贵实现这种效果。</p>
]]></content:encoded>
	</item>
</channel>
</rss>

