<?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; js</title>
	<atom:link href="http://blog.declab.com/tag/js/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.declab.com</link>
	<description></description>
	<lastBuildDate>Thu, 27 May 2010 03:45:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>最近在JS和Jquery遇到的一些问题的解决方法</title>
		<link>http://blog.declab.com/web/2009/%e6%9c%80%e8%bf%91%e5%9c%a8js%e5%92%8cjquery%e9%81%87%e5%88%b0%e7%9a%84%e4%b8%80%e4%ba%9b%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95/</link>
		<comments>http://blog.declab.com/web/2009/%e6%9c%80%e8%bf%91%e5%9c%a8js%e5%92%8cjquery%e9%81%87%e5%88%b0%e7%9a%84%e4%b8%80%e4%ba%9b%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 01:19:29 +0000</pubDate>
		<dc:creator>阿债</dc:creator>
				<category><![CDATA[WEB开发]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://rblog.declab.com/2009/1/%e6%9c%80%e8%bf%91%e5%9c%a8js%e5%92%8cjquery%e9%81%87%e5%88%b0%e7%9a%84%e4%b8%80%e4%ba%9b%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95/</guid>
		<description><![CDATA[1. JS中数值字符串相加
2. JS中浮点数的多余的精度
3. Jquery中什么时候用$(this)，什么时候不存在$(this)？


No related posts.

以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。]]></description>
			<content:encoded><![CDATA[<p><span id="more-50"></span><br />
1. JS中数值字符串相加<br />
  var a=&#8217;2.1&#8242;; var b=&#8217;13&#8242;;<br />
  var c=a+b; 则c的值为 2.113，因为+在字符串间是连接符。<br />
  如果要求a与b的和，则先要把a、b用parseFloat()或parseInt()转化为浮点数、整数<br />
  黑客方法 [color=#DC143C]var c=a-0+b;[/color] 因为[color=#DC143C] &#8211; [/color]不管是在数值还是字符串间都是减法运算，对字符串JS会自动把它转化为数值。</p>
<p>2. JS中浮点数的多余的精度<br />
  var a= 2.6; var b=2.3;<br />
  var c = a-b;<br />
  那么c的值是多少？0.3？不对，它的值是 0.3000005 0.29999997之类，总之就是不等于0.3。汗！<br />
  产生这个情况的原因是浮点数在JS中的存储方式，不仅JS，严格符合ECAMScript规范的脚本语言都有相同的问题。<br />
  解决方法 [color=#DC143C]var c = Math.round((a-b)*10)/10;[/color] 产生一位小数的精度。<br />
  为什么不直接用 (a-b)*10/10？因为当 c=0.29999997时，计算结果变成了我们不想看到的0.2。</p>
<p>3. Jquery中什么时候用$(this)，什么时候不存在$(this)？<br />
  看看这个例子，点击切换图片。<br />
  [color=#8B0000]$(function(){<br />
    $(img).bind(&#8216;click&#8217;, function(e){<br />
       $.ajax({<br />
           &#8216;url&#8217;:'http://www.declab.com/?id=&#8217;+$(this).val(),<br />
           &#8216;success&#8217;:function(html){ $(img).attr(&#8216;src&#8217;,'http://www.declab.com/images&#8217;+html) },<br />
           &#8216;cache&#8217;:false<br />
       });<br />
    });<br />
  });[/color]<br />
  在这段代码中， &#8216;url&#8217;中的 $(this) 和 &#8216;success&#8217;函数中的$(img) 都是指代码开头被点击的$(img),<br />
  但你不可以把第二个$(img)也换成$(this)，它属于函数function(html){}的局部变量，已经出了function(e){}的作用域。</p>


<p>No related posts.</p>
<p>以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。</p>]]></content:encoded>
			<wfw:commentRss>http://blog.declab.com/web/2009/%e6%9c%80%e8%bf%91%e5%9c%a8js%e5%92%8cjquery%e9%81%87%e5%88%b0%e7%9a%84%e4%b8%80%e4%ba%9b%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenLaszlo，用XML和JS生成FLASH</title>
		<link>http://blog.declab.com/web/2008/openlaszlo%ef%bc%8c%e7%94%a8xml%e5%92%8cjs%e7%94%9f%e6%88%90flash/</link>
		<comments>http://blog.declab.com/web/2008/openlaszlo%ef%bc%8c%e7%94%a8xml%e5%92%8cjs%e7%94%9f%e6%88%90flash/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 10:09:58 +0000</pubDate>
		<dc:creator>阿债</dc:creator>
				<category><![CDATA[WEB开发]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[openlaszlo]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://rblog.declab.com/2008/1/openlaszlo%ef%bc%8c%e7%94%a8xml%e5%92%8cjs%e7%94%9f%e6%88%90flash/</guid>
		<description><![CDATA[这是我看到的最令人振奋的技术了，我一直想学Flash，可是总是没有机会，但现在连基本的东西都搞不定，更别说交互的功能了。 如今，有了OpenLaszlo，用简单的XML和JS，就可以生成swf文件，并且可以和你的代码交换数据。 本身OpenLaszlo是用Java写成的，如果用你用PHP开发，就得同时安装JSP和PHP，再装mod_jk。我觉得这样超麻烦，还好它提供SOLO方式，先把OpenLaszlo代码编译成swf，不过这样就不能用远程调用RPC的之类的，还好我只需要PHP为swf提供XML格式数据。 SOLO方式编译OpenLaszlo为swf http://fallenlord.blogbus.com/logs/16125648.html [quote]2. 用浏览器输入带参数地址编译 http:///?lzr=swf8&#038;lzproxied=false[/quote] No related posts. 以上关联文章由 Yet Another Related Posts Plugin 提供支持。


No related posts.

以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。]]></description>
			<content:encoded><![CDATA[<p>这是我看到的最令人振奋的技术了，我一直想学Flash，可是总是没有机会，但现在连基本的东西都搞不定，更别说交互的功能了。<br />
如今，有了OpenLaszlo，用简单的XML和JS，就可以生成swf文件，并且可以和你的代码交换数据。<br />
<span id="more-47"></span><br />
本身OpenLaszlo是用Java写成的，如果用你用PHP开发，就得同时安装JSP和PHP，再装mod_jk。我觉得这样超麻烦，还好它提供SOLO方式，先把OpenLaszlo代码编译成swf，不过这样就不能用远程调用RPC的之类的，还好我只需要PHP为swf提供XML格式数据。</p>
<p>SOLO方式编译OpenLaszlo为swf</p>
<p>http://fallenlord.blogbus.com/logs/16125648.html</p>
<p>[quote]2. 用浏览器输入带参数地址编译</p>
<p>http://<openLaszlo服务器路径>/<你的lzx文件>?lzr=swf8&#038;lzproxied=false[/quote]</p>


<p>No related posts.</p>
<p>以上关联文章由 <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a> 提供支持。</p>]]></content:encoded>
			<wfw:commentRss>http://blog.declab.com/web/2008/openlaszlo%ef%bc%8c%e7%94%a8xml%e5%92%8cjs%e7%94%9f%e6%88%90flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
