<?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>前端天空</title>
	<atom:link href="http://www.riasky.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.riasky.com/blog</link>
	<description>致力于前端开发应用</description>
	<lastBuildDate>Wed, 25 Aug 2010 03:04:30 +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>Translate This Button 在线翻译按钮</title>
		<link>http://www.riasky.com/blog/javascript/translate-this-button/</link>
		<comments>http://www.riasky.com/blog/javascript/translate-this-button/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 01:53:45 +0000</pubDate>
		<dc:creator>德方</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Google API]]></category>
		<category><![CDATA[Translate]]></category>
		<category><![CDATA[在线翻译]]></category>

		<guid isPermaLink="false">http://www.riasky.com/blog/?p=37</guid>
		<description><![CDATA[翻译成52种语言的按钮： 只需复制并粘贴您网站上的任何地方TranslateThis按钮，它的自由和方便。有没有文件上传和它在几乎所有网站的作品。 该TranslateThis按钮是一个轻量级的Javascript翻译工具 。它翻译成任何页面快速使用Ajax和谷歌语言的API。 只不过Google在国内访问时断时续不是太稳定 &#60;!-- Begin TranslateThis Button --&#62; &#60;div id=&#34;translate-this&#34;&#62;&#60;a href=&#34;http://translateth.is/&#34; class=&#34;translate-this-button&#34;&#62;Translate&#60;/a&#62;&#60;/div&#62; &#60;script type=&#34;text/javascript&#34; src=&#34;http://www.google.com/jsapi&#34;&#62;&#60;/script&#62; &#60;script type=&#34;text/javascript&#34; src=&#34;http://x.translateth.is/translate-this.js&#34;&#62;&#60;/script&#62; &#60;script type=&#34;text/javascript&#34;&#62; TranslateThis(); &#60;/script&#62; &#60;!-- End TranslateThis Button --&#62; 可定制的选项 该TranslateThis按钮允许您设置的选择： 跟踪与谷歌分析 更改按钮图像 更改文本选项 支持的语言更改 回调函数 和更多&#8230; 下面这里是测试代码： &#60;h2&#62;可定制的选项&#60;/h2&#62; 该TranslateThis按钮允许您设置的选择： &#60;ul&#62; &#60;li&#62;跟踪与谷歌分析&#60;/li&#62; &#60;li&#62;更改按钮图像&#60;/li&#62; &#60;li&#62;更改文本选项&#60;/li&#62; &#60;li&#62;支持的语言更改&#60;/li&#62; &#60;li&#62;回调函数&#60;/li&#62; &#60;li&#62;和更多...&#60;/li&#62; &#60;/ul&#62; &#60;!-- Begin TranslateThis Button --&#62; &#60;div id=&#34;translate-this&#34;&#62;&#60;a [...]]]></description>
			<content:encoded><![CDATA[<h2><a href="http://www.riasky.com/blog/wp-content/uploads/2010/08/translation-flags.jpg"><img class="alignright size-full wp-image-32" title="translation-flags" src="http://www.riasky.com/blog/wp-content/uploads/2010/08/translation-flags.jpg" alt="" width="300" height="280" /></a>翻译成52种语言的按钮：</h2>
<p><strong>只需复制并粘贴</strong>您网站上的任何地方TranslateThis按钮，它的自由和方便。有没有文件上传和它在几乎所有网站的作品。</p>
<p>该TranslateThis按钮是一个轻量级<strong>的Javascript翻译工具</strong> 。它翻译成任何页面快速使用Ajax和谷歌语言的API。</p>
<p><strong>只不过Google在国内访问时断时续不是太稳定</strong></p>
<p><span id="more-37"></span></p>
<pre class="brush: xml;">
&lt;!-- Begin TranslateThis Button --&gt;

&lt;div id=&quot;translate-this&quot;&gt;&lt;a href=&quot;http://translateth.is/&quot; class=&quot;translate-this-button&quot;&gt;Translate&lt;/a&gt;&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://x.translateth.is/translate-this.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
TranslateThis();
&lt;/script&gt;

&lt;!-- End TranslateThis Button --&gt;
</pre>
<h2>可定制的选项</h2>
<p>该TranslateThis按钮允许您设置的选择：</p>
<ul>
<li>跟踪与谷歌分析</li>
<li>更改按钮图像</li>
<li>更改文本选项</li>
<li>支持的语言更改</li>
<li>回调函数</li>
<li>和更多&#8230;</li>
</ul>
<p><strong>下面这里是测试代码：</strong></p>
<p><strong> </strong></p>
<div class="runcode">
<p><textarea name="runcode" style="overflow-y:visible;width:600px;font-size:12px" class="runcode_text" id="runcode_GFy3u8">
&lt;h2&gt;可定制的选项&lt;/h2&gt;
该TranslateThis按钮允许您设置的选择：
&lt;ul&gt;
	&lt;li&gt;跟踪与谷歌分析&lt;/li&gt;
	&lt;li&gt;更改按钮图像&lt;/li&gt;
	&lt;li&gt;更改文本选项&lt;/li&gt;
	&lt;li&gt;支持的语言更改&lt;/li&gt;
	&lt;li&gt;回调函数&lt;/li&gt;
	&lt;li&gt;和更多...&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- Begin TranslateThis Button --&gt;
&lt;div id=&quot;translate-this&quot;&gt;&lt;a class=&quot;translate-this-button&quot; href=&quot;http://translateth.is/&quot;&gt;Translate&lt;/a&gt;&lt;/div&gt;
&lt;script src=&quot;http://www.google.com/jsapi&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;http://x.translateth.is/translate-this.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
TranslateThis();
// ]]&gt;&lt;/script&gt;
&lt;!-- End TranslateThis Button --&gt;
</textarea></p>
<script type="text/javascript">function changeTsize(){document.getElementById("runcode_GFy3u8").style.height = document.getElementById("runcode_GFy3u8").scrollHeight + "px";}window.setTimeout(changeTsize,0);</script><p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_GFy3u8');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_GFy3u8');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_GFy3u8','runcode_GFy3u8');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>详细参数见：<a href="http://translateth.is/docs" target="_blank">http://translateth.is/docs</a></p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
TranslateThis({
    GA : true, // Google Analytics tracking
    scope : 'content', // ID to confine translation
    wrapper : 'translate-this', // ID of the TranslateThis wrapper

    onLoad : function() { alert('loaded') }, // Callback function
    onClick : function() { alert('translation started') },
    onComplete : function() { alert('translation finished') },

    cookie : 'tt-lang', // Name of the cookie - set to 0 to disable

    panelText : 'Translate Into:', // Panel header text
    moreText : '36 More Languages »', // More link text
    busyText : 'Translating page...',
    cancelText : 'cancel',
    doneText : 'Translated by the', // Completion message text
    undoText : 'Undo »', // Text for untranslate link

    fromLang : 'en', // Native language of your site

    ddLangs : [ // Languages in the dropdown
        'cs',
        'pt-PT',
        'it',
        'ru',
        'ar',
        'zh-CN',
        'ja',
        'ko'
    ],

    noBtn : false, //whether to disable the button styling
    btnImg : 'http://x.translateth.is/tt-btn1.png',
    btnWidth : 180,
    btnHeight : 18,

    noImg : false, // whether to disable flag imagery
    imgHeight : 12, // height of flag icons
    imgWidth : 8, // width of flag icons
    bgImg : 'http://x.translateth.is/tt-sprite.png',

    maxLength : 900, // maxLength of strings passed to Google
    reparse : true // whether to reparse the DOM for each translation

});
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.riasky.com/blog/javascript/translate-this-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery自定义动画animate的一些使用心得</title>
		<link>http://www.riasky.com/blog/jquery/jquery-animate/</link>
		<comments>http://www.riasky.com/blog/jquery/jquery-animate/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 12:12:28 +0000</pubDate>
		<dc:creator>德方</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[animate]]></category>
		<category><![CDATA[工作心得]]></category>

		<guid isPermaLink="false">http://www.riasky.com/blog/?p=23</guid>
		<description><![CDATA[今天在工作中遇到了表单验证时提醒的动画效果，效果很简单：如果必填表单为空则此表单项的边框会闪烁几下并最终为红色。 如果只是简单的input和textarea元素的话，很简单，直接设置其边框颜色即可。 可是如果是select元素的话，在IE6/7中元素的边框色是不起作用的，于是想到了在其外面套上一个内联元素，动画操作此内联元素即可。 思路如下： 1. 一个专门接口的函数，其参数为表单元素对象； 2. 利用jQuery的animate方法来自定义动画效果：设置其border属性； 3. 监听需要验证时的事件：当前元素失去焦点时、表单提交时； 思路屡清楚之后开始行动： 1. 接口函数： function checkForm(d){ var isIE= !jQuery.support.cssFloat; // var _dom=isIE?jQuery(d).parent():jQuery(d); if(isIE){ jQuery(d).wrap('span'); _dom=jQuery(d).parent('span'); }else{ _dom=jQuery(d); } if (d.value =='') { _dom.addClass('checkform-error'); _dom.animate({border: '1px red solid'}, 100) .animate({border: '1px white solid'}, 100) .animate({border: '1px red solid'}, 100) .animate({border: '1px white solid'}, 100) .animate({border: '1px red [...]]]></description>
			<content:encoded><![CDATA[<p>今天在工作中遇到了表单验证时提醒的动画效果，效果很简单：如果必填表单为空则此表单项的边框会闪烁几下并最终为红色。<br />
如果只是简单的input和textarea元素的话，很简单，直接设置其边框颜色即可。<br />
可是如果是select元素的话，在IE6/7中元素的边框色是不起作用的，于是想到了在其外面套上一个内联元素，动画操作此内联元素即可。</p>
<p>思路如下：<br />
1. 一个专门接口的函数，其参数为表单元素对象；<br />
2. 利用jQuery的animate方法来自定义动画效果：设置其border属性；<br />
3. 监听需要验证时的事件：当前元素失去焦点时、表单提交时；</p>
<p>思路屡清楚之后开始行动：<br />
1. 接口函数：</p>
<pre class="brush: jscript;">
function checkForm(d){
	var isIE= !jQuery.support.cssFloat;
//	var _dom=isIE?jQuery(d).parent():jQuery(d);
if(isIE){
	jQuery(d).wrap('span');
	_dom=jQuery(d).parent('span');
}else{
	_dom=jQuery(d);
}

	if (d.value =='') {
		_dom.addClass('checkform-error');
		 _dom.animate({border: '1px red solid'}, 100)
			.animate({border: '1px white solid'}, 100)
			.animate({border: '1px red solid'}, 100)
			.animate({border: '1px white solid'}, 100)
			.animate({border: '1px red solid'}, 100);
	}else{
		_dom.removeClass('checkform-error').removeAttr('style');
	}
}
</pre>
<p>经过测试，FF(火狐)下没任何问题，边框啥的都可以闪烁，但到了IE下问题就来了。<br />
首先是IE下jQeury的animate中不能直接设置border样式的属性，提示“参数错误”，经过网上一顿乱找后仍然没有解决。<br />
于是换成 .animate({borderColor:&#8217;red&#8217;}) 再试试吧，结果还是不行，测试了几次之后发现IE下面只有borderWidth是可以用的。<br />
没办法只能继续想起他的办法……</p>
<p>在网上查了下animate里面可以用到的属性中可以包括：</p>
<pre class="brush: jscript;">
$().animate(
        {
               left: 100,
               style: 'margin: 10px;',
               className: 'checkWrap',
               opacity: 0.5,
               backgroundColor: 'yellow',
               borderWidth:'1'
        },
</pre>
<p>而且IE下还有个问题就是$().unwrap();不起作用，于是之前的想法就不成立了，继续想……</p>
<p>< 未完.待续…… ></p>
]]></content:encoded>
			<wfw:commentRss>http://www.riasky.com/blog/jquery/jquery-animate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>中元节祭</title>
		<link>http://www.riasky.com/blog/%e6%9d%82%e8%b0%88/7-15/</link>
		<comments>http://www.riasky.com/blog/%e6%9d%82%e8%b0%88/7-15/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 06:57:21 +0000</pubDate>
		<dc:creator>德方</dc:creator>
				<category><![CDATA[杂谈]]></category>

		<guid isPermaLink="false">http://www.riasky.com/blog/?p=3</guid>
		<description><![CDATA[中元节祭 敬畏天地间神鬼， 超度闲野间幽魂。]]></description>
			<content:encoded><![CDATA[<p>中元节祭</p>
<p>敬畏天地间神鬼，</p>
<p>超度闲野间幽魂。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.riasky.com/blog/%e6%9d%82%e8%b0%88/7-15/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery之css选择器</title>
		<link>http://www.riasky.com/blog/jquery/jquery-selector/</link>
		<comments>http://www.riasky.com/blog/jquery/jquery-selector/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 07:39:12 +0000</pubDate>
		<dc:creator>德方</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.riasky.com/blog/?p=5</guid>
		<description><![CDATA[在说jQuery之前我们也可以回忆一下CSS的选择器，我想这对我们还算是比较熟悉，分别有：标签选择器、ID选择器、类选择器、群组选择器、后代选择器、通配选择符....等等选择器,具体语法说明在这里就不说了。而我们要说了jQuery中的选择器完全继承了CSS的风格，不过jQuery选择器适应通用性更好，CSS中很多选择器IE不支持，但jQuery支持常用的浏览器。]]></description>
			<content:encoded><![CDATA[<p>使用过jquery的人都知道，jquery的选择器是很强大的，特别是对CSS选择器的支持</p>
<p>这里的地址是测试：<a href="http://www.tiscs.com/wyx/slickspeed/index.html">http://www.tiscs.com/wyx/slickspeed/index.html</a>#</p>
<p>所以想用好jquery的话，还是要先权威的了解一下W3C的css1&#8212;css3，</p>
<p><a href="http://www.w3.org/TR/css3-selectors/">http://www.w3.org/TR/css3-selectors/</a></p>
<div dir="ltr">
<p>本节非规范性，因为它只是概括了以下几个部分。</p>
<p>甲选择是一个结构。这种结构可以作为一个条件（例如，在一个正确的CSS ）  ，文档树中匹配一个元素的CSS，或作为一个单位说明HTML或XML片段相应的结构。</p>
<p>选拔范围可以从简单的元素名称，以丰富的内容表述。<br />
<span id="more-5"></span><br />
下表总结了选择语法：</p>
<table>
<thead>
<tr>
<th>样本</th>
<th>解释</th>
<th>描述</th>
<th>CSS级别</th>
</tr>
</thead>
<tbody>
<tr>
<td>*</td>
<td>匹配任意元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#universal-selector"><span style="color: #660099;">Universal selector</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E</td>
<td>匹配类型为E的元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#type-selectors"><span style="color: #660099;">Type selector</span></a></td>
<td>1</td>
</tr>
<tr>
<td>E[foo]</td>
<td>匹配含有foo属性的E元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors"><span style="color: #660099;">Attribute selectors</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E[foo="bar"]</td>
<td>匹配含有foo属性等于bar的E元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors"><span style="color: #660099;">Attribute selectors</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E[foo~="bar"]</td>
<td>匹配含有foo属性中包含bar的E元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors"><span style="color: #660099;">Attribute selectors</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E[foo^="bar"]</td>
<td>匹配含有foo属性的值从bar开头的E元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors"><span style="color: #660099;">Attribute selectors</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E[foo$="bar"]</td>
<td>匹配含有foo属性的值以bar结尾的E元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors"><span style="color: #660099;">Attribute selectors</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E[foo*="bar"]</td>
<td>匹配含有foo属性的值包含bar的E元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors"><span style="color: #660099;">Attribute selectors</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E[hreflang|="en"]</td>
<td>an E element whose &#8220;hreflang&#8221; attribute has a hyphen-separated  list of values beginning (from the left) with &#8220;en&#8221;</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors"><span style="color: #660099;">Attribute selectors</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E:root</td>
<td>an E element, root of the document</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:nth-child(n)</td>
<td>an E element, the n-th child of its parent</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:nth-last-child(n)</td>
<td>an E element, the n-th child of its parent, counting from the  last one</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:nth-of-type(n)</td>
<td>an E element, the n-th sibling of its type</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:nth-last-of-type(n)</td>
<td>an E element, the n-th sibling of its type, counting from the  last one</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:first-child</td>
<td>an E element, first child of its parent</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E:last-child</td>
<td>an E element, last child of its parent</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:first-of-type</td>
<td>an E element, first sibling of its type</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:last-of-type</td>
<td>an E element, last sibling of its type</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:only-child</td>
<td>an E element, only child of its parent</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:only-of-type</td>
<td>an E element, only sibling of its type</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:empty</td>
<td>an E element that has no children (including text nodes)</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos"><span style="color: #660099;">Structural pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:link<br />
E:visited</td>
<td>an E element being the source anchor of a hyperlink of which  the target is not yet visited (:link) or already visited (:visited)</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#link"><span style="color: #660099;">The link pseudo-classes</span></a></td>
<td>1</td>
</tr>
<tr>
<td>E:active<br />
E:hover<br />
E:focus</td>
<td>an E element during certain user actions</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#useraction-pseudos"><span style="color: #660099;">The user action pseudo-classes</span></a></td>
<td>1 and 2</td>
</tr>
<tr>
<td>E:target</td>
<td>an E element being the target of the referring URI</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#target-pseudo"><span style="color: #660099;">The target pseudo-class</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:lang(fr)</td>
<td>an element of type E in language &#8220;fr&#8221; (the document language  specifies how language is determined)</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#lang-pseudo"><span style="color: #660099;">The  :lang() pseudo-class</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E:enabled<br />
E:disabled</td>
<td>a user interface element E which is enabled or disabled</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#UIstates"><span style="color: #660099;">The UI  element states pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E:checked</td>
<td>a user interface element E which is checked (for instance a  radio-button or checkbox)</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#UIstates"><span style="color: #660099;">The UI  element states pseudo-classes</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E::first-line</td>
<td>the first formatted line of an E element</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#first-line"><span style="color: #660099;">The  ::first-line pseudo-element</span></a></td>
<td>1</td>
</tr>
<tr>
<td>E::first-letter</td>
<td>the first formatted letter of an E element</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#first-letter"><span style="color: #660099;">The  ::first-letter pseudo-element</span></a></td>
<td>1</td>
</tr>
<tr>
<td>E::selection</td>
<td>the portion of an E element that is currently  selected/highlighted by the user</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#UIfragments"><span style="color: #660099;">The  UI element fragments pseudo-elements</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E::before</td>
<td>generated content before an E element</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#gen-content"><span style="color: #660099;">The  ::before pseudo-element</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E::after</td>
<td>generated content after an E element</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#gen-content"><span style="color: #660099;">The  ::after pseudo-element</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E.warning</td>
<td>an E element whose class is &#8220;warning&#8221; (the document language  specifies how class is determined).</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#class-html"><span style="color: #660099;">Class  selectors</span></a></td>
<td>1</td>
</tr>
<tr>
<td>E#myid</td>
<td>an E element with ID equal to &#8220;myid&#8221;.</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#id-selectors"><span style="color: #660099;">ID  selectors</span></a></td>
<td>1</td>
</tr>
<tr>
<td>E:not(s)</td>
<td>an E element that does not match simple selector s</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#negation"><span style="color: #660099;">Negation pseudo-class</span></a></td>
<td>3</td>
</tr>
<tr>
<td>E F</td>
<td>E元素下的所有F元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#descendant-combinators"><span style="color: #660099;">Descendant combinator</span></a></td>
<td>1</td>
</tr>
<tr>
<td>E &gt; F</td>
<td>所有E与F是父子关系的F元素</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#child-combinators"><span style="color: #660099;">Child combinator</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E + F</td>
<td>
<div>匹配所有紧接在 E元素后的 F元素</div>
</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#adjacent-sibling-combinators"><span style="color: #660099;">Adjacent sibling combinator</span></a></td>
<td>2</td>
</tr>
<tr>
<td>E ~ F</td>
<td>
<div>匹配 E 元素之后的所有 F元素</div>
</td>
<td><a href="http://www.w3.org/TR/css3-selectors/#general-sibling-combinators"><span style="color: #660099;">General sibling combinator</span></a></td>
<td>3</td>
</tr>
</tbody>
</table>
<p>jQuery的:nth-child(index/even/odd/equation)</p>
<p>匹配其父元素下的第N个子或奇偶元素，&#8217;:eq(index)&#8217;  只匹配一个元素，而这个将为每一个父元素匹配子元素。:nth-child从1开始的，而:eq()是从0算起的！</p>
<p>可以使用：</p>
<p>nth-child(even)<br />
:nth-child(odd)<br />
:nth-child(3n)<br />
:nth-child(2)<br />
:nth-child(3n+1)<br />
:nth-child(3n+2)</p>
<p>例如：</p>
<p>在每个 ul 查找第 2 个li</p>
<p><strong>HTML 代码:</strong></p>
<div>&lt;ul&gt;<br />
&lt;li&gt;John&lt;/li&gt;<br />
&lt;li&gt;Karl&lt;/li&gt;<br />
&lt;li&gt;Brandon&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;Glen&lt;/li&gt;<br />
&lt;li&gt;Tane&lt;/li&gt;<br />
&lt;li&gt;Ralph&lt;/li&gt;<br />
&lt;/ul&gt;</div>
<p><strong>jQuery 代码:</strong></p>
<div>$(&#8220;ul li:nth-child(2)&#8221;)</div>
<p><strong>结果:</strong></p>
<div>[ &lt;li&gt;Karl&lt;/li&gt;, &lt;li&gt;Tane&lt;/li&gt; ]</div>
<p>:nth-child(Xn+Y)</p>
<p>匹配集合中子集每隔X个元素的第Xn+Y元素集合。返回匹配元素集合</p>
<p>:nth-child(2n+3)  表示从第3个开始，递增2。结果：3、5、7、9 、11、&#8230;<br />
:nth-child(3n+10)  表示从第10个开始，递增3。结果：10、13、16、19 、&#8230;</p>
<p><strong>&#8212;-以下来自互联网</strong></p>
<p><strong>语法：</strong></p>
<pre>:nth-child(<em>an+b</em>)</pre>
<p>为什么选择她，因为我认为，这个选择器是最多学问的一个了。很可惜，据我所测，目前能较好地支持她的只有Opera9+和Safari3+。</p>
<p><strong>描述：</strong></p>
<p>伪类<strong>:nth-child()</strong>的参数是<em>an+b</em>，如果按照w3.org上的描述，写成中文，很可能会让人头晕，再加上笔者的文笔水平有限，所以我决定避开an+b的说法，把它拆分成5种写法共5部分来说明。</p>
<h3><strong>第一种：简单数字序号写法</strong></h3>
<p><strong>:nth-child(<em>number</em>)</strong></p>
<p>直接匹配第number个元素。参数<em>number</em>必须为大于0的整数。</p>
<p>例子：<strong><br />
</strong></p>
<pre>li:nth-child(3){background:orange;}/*把第3个LI的背景设为橙色*/</pre>
<h3><strong>第二种：倍数写法</strong></h3>
<p><strong>:nth-child(<em>an</em>)</strong></p>
<p>匹配所有倍数为a的元素。其中参数<em>an</em>中的字母<em>n</em>不可缺省，它是倍数写法的标志，如3n、5n。</p>
<p>例子：</p>
<p>li:nth-child(3n){background:orange;}/*把第3、第6、第9、…、所有3的倍数的LI的背景设为橙色*/</p>
<h3><strong>第三种：倍数分组匹配</strong></h3>
<p><strong>:nth-child(<em>an+b</em>) 与 </strong><strong>:nth-child(<em>an-b</em>)</strong></p>
<p>先对元素进行分组，每组有<em>a</em>个，<em>b</em>为组内成员的序号，其中字母<em>n</em>和加号<em>+</em>不可缺省，位置不可调换，这是该写法的标志，其中<em>a</em>,<em>b</em>均为正整数或0。如3n+1、5n+1。但加号可以变为负号，此时匹配组内的第a-b个。（其实<em>an</em>前面也可以是负号，但留给下一部分讲。）</p>
<p>例子：</p>
<p>li:nth-child(3n+1){background:orange;}/*匹配第1、第4、第7、…、每3个为一组的第1个LI*/</p>
<p>li:nth-child(3n+5){background:orange;}/*匹配第5、第8、第11、…、从第5个开始每3个为一组的第1个LI*/</p>
<p>li:nth-child(5n-1){background:orange;}/*匹配第5-1=4、第10-1=9、…、第5的倍数减1个LI*/</p>
<p>li:nth-child(3n±0){background:orange;}/*相当于(3n)*/</p>
<p>li:nth-child(±0n+3){background:orange;}/*相当于(3)*/</p>
<h3><strong>第四种：反向倍数分组匹配</strong></h3>
<p><strong>:nth-child(<em>-an+b</em>)</strong></p>
<p>此处一负一正，均不可缺省，否则无意义。这时与<strong>:nth-child(<em>an+1</em>)</strong>相似，都是匹配第1个，但不同的是它是倒着算的，从第<em>b</em>个开始往回算，所以它所匹配的最多也不会超过<em>b</em>个。</p>
<p>例子：</p>
<p>li:nth-child(-3n+8){background:orange;}/*匹配第8、第5和第2个LI*/</p>
<p>li:nth-child(-1n+8){background:orange;}/*或(<em>-n+8</em>)，匹配前8个（包括第8个）LI，这个较为实用点，用来限定前面N个匹配常会用到*/</p>
<h3><strong>第五种：奇偶匹配</strong></h3>
<p><strong>:nth-child(<em>odd</em>) 与 </strong><strong>:nth-child(<em>even</em>)</strong></p>
<p>分别匹配序号为奇数与偶数的元素。奇数(odd)与(2n+1)结果一样；偶数(even)与(2n+0)及(2n)结果一样。</p>
<p><strong>附：例子效果图</strong></p>
<p><a href="http://www.flickr.com/photos/govo/2798803647/"><img title="CSS3 :nth-child" src="http://farm4.static.flickr.com/3193/2798803647_3d3d00b843_d.jpg" alt="" width="500" height="168" /></a></p>
<p>选择器是jQuery最重要的部分之一，在jQuery中对事件处理，DOM操作和Ajax操作都依赖于选择器，熟练使用选择器，不仅能简化代码，还可以达到事半功倍的效果。</p>
<p>在说jQuery之前我们也可以回忆一下CSS的选择器，我想这对我们还算是比较熟悉，分别有：标签选择器、ID选择器、类选择器、群组选择器、后代选择器、通配选择符&#8230;.等等选择器,具体语法说明在这里就不说了。而我们要说了jQuery中的选择器完全继承了CSS的风格，不过jQuery选择器适应通用性更好，CSS中很多选择器IE不支持，但jQuery支持常用的浏览器。</p>
<p>$的选择器部分，凡是运用符号：$，其返回值都是一个object。</p>
<p>下面分类别的简单介绍一下jQuery选择器：</p>
<p><strong>1、基本选择器:通过标签元素id、class、标签名等来查找DOM元素</strong></p>
<p>$(&#8220;#id名&#8221;)，如$(&#8220;#test&#8221;)是选取了id为test的标签节点</p>
<p>$(&#8220;标签名&#8221;)，如$(&#8220;p&#8221;)是选取了所有的P标签节点</p>
<p>$(&#8220;.class名&#8221;)，如$(&#8220;.test&#8221;)是选取了所有class为test的标签节点</p>
<p>$(&#8220;*&#8221;),如$(&#8220;*&#8221;)是选取所有的标签元素</p>
<p>$(&#8220;标签名1,标签名2,&#8230;&#8221;)，如$(&#8220;div,span,p.myClass&#8221;)是选取所有&lt;div&gt;,&lt;span&gt;和拥有class为myClass的&lt;p&gt;的一线标签元素。</p>
<p><strong>2、层次选择器:通过DOM元素的层次关系来获取特定元素，包括后代元素、子元素、相依元素、兄弟元素等。</strong></p>
<p>$(&#8220;标签名 标签名&#8221;)，如$(&#8220;div span&#8221;)选取&lt;div&gt;里所有的&lt;span&gt;元素</p>
<p>$(&#8220;parent  child&#8221;)，如$(&#8220;div&gt;span&#8221;)选取&lt;div&gt;元素下元素名是&lt;span&gt;的子元素</p>
<p>$(&#8216;prev+next&#8217;)等价$(&#8216;prev&#8217;).next(&#8216;next&#8217;)，如$(&#8216;.one+div&#8217;)等价$(&#8216;.one&#8217;).next(&#8216;div&#8217;)是选取class为one的下一个&lt;div&gt;标签元素</p>
<p>$(&#8216;prev~siblings&#8217;)等价$(&#8216;prev&#8217;).nextAll(&#8216;div&#8217;)，如(&#8216;#two~div&#8217;)等价$(&#8216;#two&#8217;).nextAll(&#8216;div&#8217;)是选取id为two的元素后面的所有&lt;div&gt;兄弟元素</p>
<p><strong>3、过滤选择器：主要是通过一些过滤规则来筛选DOM元素，过滤规则与CSS中的伪类选择器语法相同，即选择器都以一个冒号(:)开头</strong></p>
<p>$(&#8220;标签元素:first&#8221;)，如$(&#8220;div:first&#8221;)是选取所有&lt;div&gt;元素中第一个&lt;div&gt;元素</p>
<p>原文：<a href="http://hi.baidu.com/meteoric_cry/blog/item/dcb48b19f75e6b4242a9ade0.html" target="_blank">http://hi.baidu.com/meteoric_cry/blog/item/dcb48b19f75e6b4242a9ade0.html</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.riasky.com/blog/jquery/jquery-selector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://www.riasky.com/blog/default/hello-world/</link>
		<comments>http://www.riasky.com/blog/default/hello-world/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 06:20:54 +0000</pubDate>
		<dc:creator>德方</dc:creator>
				<category><![CDATA[默认]]></category>

		<guid isPermaLink="false">http://www.riasky.com/blog/?p=1</guid>
		<description><![CDATA[欢迎使用 WordPress。这是您的第一篇日志。您可以编辑它或是删除它，然后开始写您自己的博客。]]></description>
			<content:encoded><![CDATA[<p>欢迎使用 WordPress。这是您的第一篇日志。您可以编辑它或是删除它，然后开始写您自己的博客。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.riasky.com/blog/default/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
