<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>最优良人 &#187; Xheditor</title>
	<atom:link href="http://www.zui88.com/view-tag/xheditor/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zui88.com/blog</link>
	<description>中山php&#124;最优网络</description>
	<lastBuildDate>Mon, 13 May 2013 04:56:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>异步加载可视化编辑器 Xheditor</title>
		<link>http://www.zui88.com/blog/view-110.html</link>
		<comments>http://www.zui88.com/blog/view-110.html#comments</comments>
		<pubDate>Sun, 14 Aug 2011 17:02:54 +0000</pubDate>
		<dc:creator>lin</dc:creator>
				<category><![CDATA[网站前端]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[Xheditor]]></category>
		<category><![CDATA[异步]]></category>

		<guid isPermaLink="false">http://www.zui88.com/blog/?p=110</guid>
		<description><![CDATA[如果像上一篇文章使用基于Jquery的可视化编辑器 Xheditor 那样设置的话，访问页面时会加载70多k的jquery文件和50多k的xheditor文件，为了追求页面默认加载的性能提升，其实这些文件完全可以在编辑的时候异步加载的，下面是操作步骤： 1，需要用到一个异步加载js文件并执行的函数 function getJsFile(url, callBack){ var XH = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject('Msxml2.XMLHTTP'); XH.open('get',url,true); XH.onreadystatechange = function(){ if(XH.readyState == 4 &#38;&#38; XH.status == 200){ if(window.execScript) window.execScript(XH.responseText); else eval.call(window, XH.responseText); eval(callBack); } } XH.send(''); } 第一个参数url为js路径，第二个回调函数是加载完js之后的操作 2，由于我采用js初始化编辑器的方式，并且我把初始化的内容统一放到一个js文件以便以后统一更改样式，所以我异步加载的时候会加载三个文件。使用以下代码： function callback(){ }; var is_load; is_load = false; function loads(){ if(!is_load){ getJsFile('/js/jquery-1.4.2.min.js','callback'); getJsFile('/js/editor/xheditor-en.min.js','callback'); getJsFile('js/editor/editor.js','callback'); is_load [...]]]></description>
			<content:encoded><![CDATA[<div style="line-height: 25px;">
<p>如果像上一篇文章<a href="http://www.zui88.com/blog/view-108.html"><span style="font-size: x-small;">使用基于Jquery的可视化编辑器 Xheditor </span></a> 那样设置的话，访问页面时会加载70多k的jquery文件和50多k的xheditor文件，为了追求页面默认加载的性能提升，其实这些文件完全可以在编辑的时候异步加载的，下面是操作步骤：</p>
<p>1，需要用到一个异步加载js文件并执行的函数</p>
<p>function getJsFile(url, callBack){</p>
<p>var XH = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject('Msxml2.XMLHTTP');</p>
<p>XH.open('get',url,true);</p>
<p>XH.onreadystatechange = function(){</p>
<p> if(XH.readyState == 4 &amp;&amp; XH.status == 200){ if(window.execScript) window.execScript(XH.responseText);</p>
<p> else eval.call(window, XH.responseText);</p>
<p>eval(callBack);</p>
<p> }</p>
<p> }</p>
<p> XH.send('');</p>
<p> }</p>
<p>第一个参数url为js路径，第二个回调函数是加载完js之后的操作</p>
<p>2，由于我采用js初始化编辑器的方式，并且我把初始化的内容统一放到一个js文件以便以后统一更改样式，所以我异步加载的时候会加载三个文件。使用以下代码：</p>
<p>function callback(){ };</p>
<p>var is_load;</p>
<p> is_load = false;</p>
<p> function loads(){</p>
<p> if(!is_load){  </p>
<p> getJsFile('/js/jquery-1.4.2.min.js','callback');  </p>
<p> getJsFile('/js/editor/xheditor-en.min.js','callback');  </p>
<p>getJsFile('js/editor/editor.js','callback');</p>
<p>  is_load = true;  </p>
<p>}</p>
<p>};  回调函数留空，变量is_open判断是否已经加载过，防止重复加载</p>
<p>3，在textera框外面加一层span ,onclick="loads()"</p>
<p>大功告成了，只要一点击textarea就会调用js并且执行</p>
<p>不过有一点需要注意的是，由于xheditor默认是根据 页面这一条语句去判断插件所在的位置，由于采用异步加载所以网页头部没放这一行，解决的方法是在插件目录在建一个js文件，叫xheditor-autoload.js,刚好把上面那个 getJsFile()函数放进去，然后在放到页面头部位置： ，大小不到1k，算可以接受。</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.zui88.com/blog/view-110.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>使用基于Jquery的可视化编辑器 Xheditor</title>
		<link>http://www.zui88.com/blog/view-108.html</link>
		<comments>http://www.zui88.com/blog/view-108.html#comments</comments>
		<pubDate>Sun, 14 Aug 2011 17:00:43 +0000</pubDate>
		<dc:creator>lin</dc:creator>
				<category><![CDATA[网站前端]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Xheditor]]></category>

		<guid isPermaLink="false">http://www.zui88.com/blog/?p=108</guid>
		<description><![CDATA[使用方法 1. 下载xhEditor最新版本。 下载地址：http://code.google.com/p/xheditor/downloads/list 2. 解压压缩文件，将其中的xheditor.js以及xheditor_emot、xheditor_plugins和xheditor_skin三个文件夹上传到网站相应目录 3. 在相应html文件的&#60;/head&#62;之前添加 &#60;script type="text/javascript" src="http://static.xxx.com/js/jquery.js"&#62;&#60;/script&#62; &#60;script type="text/javascript" src="http://static.xxx.com/js/xheditor.js"&#62;&#60;/script&#62; 4. 方法1：在textarea上添加属性： class="xheditor {skin:'default'}"，前面主参数也可以是xheditor-mini和xheditor-simple，分别加载迷你和简单工具栏，后面详细参数可以省略 方法2：在您的页面初始JS代码里加上： $('#elm1').xheditor(); $('#elm1').xheditor()； 例如： $({ $('#elm1').xheditor()； }); 相应的删除编辑器的代码为 $('#elm1').xheditor(false)； 重要说明：2种初始化方法只能选择其中一种，不能混合使用，优先级分别是：方法1&#62;方法2，例如用了方法1，方法2就无法使用了 更多帮助信息，请查看在线帮助：http://code.google.com/p/xheditor/wiki/Help 或者参考demos文件夹中的演示页面 建议使用wizard.html初始化代码生成向导来生成适合你的代码。]]></description>
			<content:encoded><![CDATA[<div style="line-height: 25px;">
<p>使用方法</p>
<p>1. 下载xhEditor最新版本。<br />
   下载地址：<a href="http://code.google.com/p/xheditor/downloads/list">http://code.google.com/p/xheditor/downloads/list</a></p>
<p>2. 解压压缩文件，将其中的xheditor.js以及xheditor_emot、xheditor_plugins和xheditor_skin三个文件夹上传到网站相应目录</p>
<p>3. 在相应html文件的&lt;/head&gt;之前添加<br />
&lt;script type="text/javascript" src="<a href="http://static.xxx.com/js/jquery.js">http://static.xxx.com/js/jquery.js"&gt;&lt;/script</a>&gt;<br />
&lt;script type="text/javascript" src="<a href="http://static.xxx.com/js/xheditor.js">http://static.xxx.com/js/xheditor.js"&gt;&lt;/script</a>&gt;</p>
<p>4.<br />
方法1：在textarea上添加属性： class="xheditor {skin:'default'}"，前面主参数也可以是xheditor-mini和xheditor-simple，分别加载迷你和简单工具栏，后面详细参数可以省略<br />
方法2：在您的页面初始JS代码里加上： $('#elm1').xheditor();<br />
$('#elm1').xheditor()；<br />
例如：<br />
$({<br />
$('#elm1').xheditor()；<br />
});<br />
相应的删除编辑器的代码为<br />
$('#elm1').xheditor(false)；<br />
重要说明：2种初始化方法只能选择其中一种，不能混合使用，优先级分别是：方法1&gt;方法2，例如用了方法1，方法2就无法使用了<br />
更多帮助信息，请查看在线帮助：<a href="http://code.google.com/p/xheditor/wiki/Help">http://code.google.com/p/xheditor/wiki/Help</a><br />
或者参考demos文件夹中的演示页面<br />
建议使用wizard.html初始化代码生成向导来生成适合你的代码。</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.zui88.com/blog/view-108.html/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>异步加载 Xheditor 的时候遇到的浏览器兼容问题</title>
		<link>http://www.zui88.com/blog/view-104.html</link>
		<comments>http://www.zui88.com/blog/view-104.html#comments</comments>
		<pubDate>Sat, 13 Aug 2011 18:55:17 +0000</pubDate>
		<dc:creator>lin</dc:creator>
				<category><![CDATA[网站前端]]></category>
		<category><![CDATA[Xheditor]]></category>
		<category><![CDATA[异步加载]]></category>

		<guid isPermaLink="false">http://www.zui88.com/blog/?p=104</guid>
		<description><![CDATA[由于各个浏览器对js代码的异步执行函数的支持不一样 window.execScript() 只支持IE浏览器 eval() 虽然支持各个浏览器，但是却不能在全局执行 解决的方法是利用javascript里面有一个改变上下文环境的关键字with . 把GetJsFile方法改成如下： function getJsFile(url, callBack){ var XH = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject('Msxml2.XMLHTTP'); XH.open('get',url,true); XH.onreadystatechange = function(){ if(XH.readyState == 4 &#38;&#38; XH.status == 200){ with ( window )eval(XH.responseText); //if(window.execScript) window.execScript(XH.responseText); //else eval.call(window, XH.responseText); with ( window )eval(callBack); } } XH.send(''); }]]></description>
			<content:encoded><![CDATA[<div style="line-height: 25px;">
<p><span style="color: #000000;">由于各个浏览器对js代码的异步执行函数的支持不一样</span></p>
<p><span style="color: #000000;">window.execScript() 只支持IE浏览器</span></p>
<p><span style="color: #000000;">eval() 虽然支持各个浏览器，但是却不能在全局执行</span></p>
<p>解决的方法是利用javascript里面有一个改变上下文环境的关键字<span style="color: #0000ff;">with</span> .</p>
<p>把GetJsFile方法改成如下：</p>
<p>function getJsFile(url, callBack){<br />
var XH = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject('Msxml2.XMLHTTP');<br />
XH.open('get',url,true);<br />
XH.onreadystatechange = function(){<br />
if(XH.readyState == 4 &amp;&amp; XH.status == 200){<br />
with ( window  )eval(XH.responseText);<br />
//if(window.execScript) window.execScript(XH.responseText);<br />
//else eval.call(window, XH.responseText);<br />
with ( window  )eval(callBack);<br />
}<br />
}<br />
XH.send('');<br />
}</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.zui88.com/blog/view-104.html/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>
