<?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>SLJ.me - 申力军 &#187; HTML/CSS</title>
	<atom:link href="http://slj.me/category/htmlcss/feed/" rel="self" type="application/rss+xml" />
	<link>http://slj.me</link>
	<description>申力军的博客</description>
	<lastBuildDate>Mon, 05 Dec 2011 05:35:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>JavaScript 操作select控件大全（新增、修改、删除、选中、清空、判断存在等）</title>
		<link>http://slj.me/2010/12/javascript-select-operations/</link>
		<comments>http://slj.me/2010/12/javascript-select-operations/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 02:38:21 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[select]]></category>

		<guid isPermaLink="false">http://slj.me/?p=2124</guid>
		<description><![CDATA[转载一篇，这个有的时候还是很有用的，所以收藏一下 1、判断select选项中 是否存在Value=&#8221;paraValue&#8221;的Item 2、向select选项中 加入一个Item 3、从select选项中 删除一个Item 4、删除select中选中的项 5、修改select选项中 value=&#8221;paraValue&#8221;的text为&#8221;paraText&#8221; 6、设置select中text=&#8221;paraText&#8221;的第一个Item为选中 7、设置select中value=&#8221;paraValue&#8221;的Item为选中 8、得到select的当前选中项的value 9、得到select的当前选中项的text 10、得到select的当前选中项的Index 11、清空select的项 //js 代码 // 1.判断select选项中 是否存在Value="paraValue"的Item function jsSelectIsExitItem(objSelect, objItemValue) { var isExit = false; for (var i = 0; i < objSelect.options.length; i++) { if (objSelect.options[i].value == objItemValue) { isExit = true; break; } } return isExit; } // 2.向select选项中 加入一个Item function jsAddItemToSelect(objSelect, objItemText, [...]]]></description>
			<content:encoded><![CDATA[<p>转载一篇，这个有的时候还是很有用的，所以收藏一下</p>
<p>1、判断select选项中 是否存在Value=&#8221;paraValue&#8221;的Item<br />
2、向select选项中 加入一个Item<br />
3、从select选项中 删除一个Item<br />
4、删除select中选中的项<br />
5、修改select选项中 value=&#8221;paraValue&#8221;的text为&#8221;paraText&#8221;<br />
6、设置select中text=&#8221;paraText&#8221;的第一个Item为选中<br />
7、设置select中value=&#8221;paraValue&#8221;的Item为选中<br />
8、得到select的当前选中项的value<br />
9、得到select的当前选中项的text<br />
10、得到select的当前选中项的Index<br />
11、清空select的项</p>
<p><span id="more-2124"></span></p>
<pre class="js" name="code">
//js 代码
// 1.判断select选项中 是否存在Value="paraValue"的Item
function jsSelectIsExitItem(objSelect, objItemValue) {
    var isExit = false;
    for (var i = 0; i < objSelect.options.length; i++) {
        if (objSelect.options[i].value == objItemValue) {
            isExit = true;
            break;
        }
    }
    return isExit;
}         

// 2.向select选项中 加入一个Item
function jsAddItemToSelect(objSelect, objItemText, objItemValue) {
    //判断是否存在
    if (jsSelectIsExitItem(objSelect, objItemValue)) {
        alert("该Item的Value值已经存在");
    } else {
        var varItem = new Option(objItemText, objItemValue);
        objSelect.options.add(varItem);
        alert("成功加入");
    }
}        

// 3.从select选项中 删除一个Item
function jsRemoveItemFromSelect(objSelect, objItemValue) {
    //判断是否存在
    if (jsSelectIsExitItem(objSelect, objItemValue)) {
        for (var i = 0; i < objSelect.options.length; i++) {
            if (objSelect.options[i].value == objItemValue) {
                objSelect.options.remove(i);
                break;
            }
        }
        alert("成功删除");
    } else {
        alert("该select中 不存在该项");
    }
}    

// 4.删除select中选中的项
function jsRemoveSelectedItemFromSelect(objSelect) {
    var length = objSelect.options.length - 1;
    for(var i = length; i >= 0; i--){
        if(objSelect[i].selected == true){
            objSelect.options[i] = null;
        }
    }
}      

// 5.修改select选项中 value="paraValue"的text为"paraText"
function jsUpdateItemToSelect(objSelect, objItemText, objItemValue) {
    //判断是否存在
    if (jsSelectIsExitItem(objSelect, objItemValue)) {
        for (var i = 0; i < objSelect.options.length; i++) {
            if (objSelect.options[i].value == objItemValue) {
                objSelect.options[i].text = objItemText;
                break;
            }
        }
        alert("成功修改");
    } else {
        alert("该select中 不存在该项");
    }
}        

// 6.设置select中text="paraText"的第一个Item为选中
function jsSelectItemByValue(objSelect, objItemText) {
    //判断是否存在
    var isExit = false;
    for (var i = 0; i < objSelect.options.length; i++) {
        if (objSelect.options[i].text == objItemText) {
            objSelect.options[i].selected = true;
            isExit = true;
            break;
        }
    }
    //Show出结果
    if (isExit) {
        alert("成功选中");
    } else {
        alert("该select中 不存在该项");
    }
}        

// 7.设置select中value="paraValue"的Item为选中
document.all.objSelect.value = objItemValue;    

// 8.得到select的当前选中项的value
var currSelectValue = document.all.objSelect.value;    

// 9.得到select的当前选中项的text
var currSelectText = document.all.objSelect.options[document.all.objSelect.selectedIndex].text;    

// 10.得到select的当前选中项的Index
var currSelectIndex = document.all.objSelect.selectedIndex;    

// 11.清空select的项
document.all.objSelect.options.length = 0;
</pre>
</pre>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/04/mysql-group-by-having/" title="MySQL: group by &#8230; having &#8230;">MySQL: group by &#8230; having &#8230;</a></li><li><a href="http://slj.me/2010/03/45-fresh-useful-javascript-and-jquery-techniques-and-tools/" title="[英,转]45个新鲜有用的JS与jQuery技术和工具">[英,转]45个新鲜有用的JS与jQuery技术和工具</a></li><li><a href="http://slj.me/2010/03/building-iphone-apps-with-html-css-and-javascript/" title="【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript">【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript</a></li><li><a href="http://slj.me/2010/01/js%e8%8e%b7%e5%8f%96%e6%b5%8f%e8%a7%88%e5%99%a8%e7%aa%97%e5%8f%a3%e5%a4%a7%e5%b0%8f-%e8%8e%b7%e5%8f%96%e5%b1%8f%e5%b9%95%ef%bc%8c%e6%b5%8f%e8%a7%88%e5%99%a8%ef%bc%8c%e7%bd%91%e9%a1%b5%e9%ab%98/" title="JS获取浏览器窗口大小 获取屏幕，浏览器，网页高度宽度 ">JS获取浏览器窗口大小 获取屏幕，浏览器，网页高度宽度 </a></li><li><a href="http://slj.me/2009/07/javascript-pic-reflection-glossy-effect/" title="Javascript 实现图像倒影、发光效果">Javascript 实现图像倒影、发光效果</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/12/javascript-select-operations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>20个jQuery新效果</title>
		<link>http://slj.me/2010/10/20-jquery-new-effects/</link>
		<comments>http://slj.me/2010/10/20-jquery-new-effects/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 16:18:50 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://slj.me/?p=2055</guid>
		<description><![CDATA[本文将介绍20个最新的jQuery效果，还有值得一提的是8月份jQuery 发布移动设备版本 jQuery Mobile。 1. Custom Animation Banner with jQuery 通过使用 jQuery Easing和jQuery 2D Transform插件，创建自定义animation banner。 View Demo（查看示例） 2. 快速反馈表 – jQuery &#38; PHP Martin Angelov 将教你如何快速的创建用于接收来自用户反馈的解决方案，使用到了jQuery, PHP 和 PHPMailer类。 View Demo（查看示例） 3. Wijmo – jQuery UI 组件 Wijmo是一个jQuery UI组件集，有超过30多个jQuery UI 组件；这将是一个CSS3，SVG，HTML5的混合物，目前还处于Beta阶段。 View Demo（查看示例） 4. 页面导航 – jQuery插件 这是一个页面上的导航插件，基于jQuery ScrollTo 插件，你可以在 Github上查看更多介绍。 View Demo（查看示例） 5. [...]]]></description>
			<content:encoded><![CDATA[<p><img height="232" width="595" alt="" src="http://slj.me/wp-content/uploads/2010/10/20_new_jquery_effects_post_thumb.png" class="thumb"/></p>
<p>本文将介绍20个最新的jQuery效果，还有值得一提的是8月份<a rel="external" href="http://www.javaeye.com/news/17316">jQuery 发布移动设备版本 jQuery Mobile</a>。</p>
<p><span id="more-2055"></span><br />
1. <a href="http://tympanus.net/codrops/2010/10/18/custom-animation-banner/" target="_blank">Custom Animation Banner with jQuery</a></p>
<blockquote><p>通过使用 <a href="http://gsgd.co.uk/sandbox/jquery/easing/" target="_blank">jQuery Easing</a>和j<a href="http://plugins.jquery.com/project/2d-transform" target="_blank">Query 2D Transform</a>插件，创建自定义animation banner。</p>
<p><a href="http://tympanus.net/Tutorials/CustomAnimationBanner/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>2. <a href="http://tutorialzine.com/2010/09/quick-feedback-form-php-jquery/" target="_blank">快速反馈表 – jQuery &amp; PHP</a></p>
<blockquote><p><a href="http://twitter.com/tutorialzine" target="_blank">Martin Angelov</a> 将教你如何快速的创建用于接收来自用户反馈的解决方案，使用到了jQuery, PHP 和 PHPMailer类。</p>
<p><a href="http://twitter.com/tutorialzine" target="_blank"></a><a href="http://demo.tutorialzine.com/2010/09/quick-feedback-form-php-jquery/feedback.html" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>3. <a href="http://wijmo.com/" target="_blank">Wijmo – jQuery UI 组件</a></p>
<blockquote><p>Wijmo是一个jQuery UI组件集，有超过30多个jQuery UI 组件；这将是一个CSS3，SVG，HTML5的混合物，目前还处于Beta阶段。</p>
<p><a href="http://wijmo.com/Wijmo-Open/samples/index.html" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>4. <a href="http://trevordavis.net/blog/jquery-one-page-navigation-plugin/" target="_blank">页面导航 – jQuery插件</a></p>
<p><a href="http://trevordavis.net/blog/jquery-one-page-navigation-plugin/" target="_blank"> </a></p>
<blockquote><p>这是一个页面上的导航插件，基于<a href="http://flesler.blogspot.com/2007/10/jqueryscrollto.html" target="_blank">jQuery ScrollTo </a>插件，你可以在 <a href="http://github.com/davist11/jQuery-One-Page-Nav" target="_blank">Github</a>上查看更多介绍。</p>
<p><a href="http://trevordavis.net/play/jquery-one-page-nav/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>5. <a href="http://net.tutsplus.com/tutorials/javascript-ajax/how-to-build-an-rss-reader-with-jquery-mobile-2/" target="_blank">RSS Reader With jQuery Mobile</a></p>
<blockquote><p><a href="http://www.twitter.com/nettuts" target="_blank">Jeffrey Way</a> 创建了一个简单的RSS reader，主要用于iphone和Andriod手机，通过PHP和jQuery mobile 实现。</p>
<p><a href="http://demo.jeffrey-way.com/tutsMobile/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>6. <a href="http://www.madeincima.eu/blog/jquery-plugin-easy-accordion/" target="_blank">Easy Accordion – jQuery插件</a></p>
<blockquote><p>The Easy Accordion插件可以生成一个类似手风琴样子的自定义列表。</p>
<p><a href="http://www.madeincima.eu/samples/jquery/easyAccordion/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>7. <a href="http://github.com/davatron5000/Lettering.js" target="_blank">Lettering – jQuery Typography Plugin</a></p>
<blockquote><p>Lettering是一个轻量级易于使用的网页排版插件，例如印刷CSS3的海报，自定义类型的标题等。</p>
<p><a href="http://daverupert.com/2010/09/lettering-js/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>8. <a href="http://tympanus.net/codrops/2010/10/12/annotation-overlay-effect/" target="_blank">Annotation Overlay Effect with jQuery</a></p>
<blockquote><p>创建一个简单的叠加效应</p>
<p><a href="http://tympanus.net/Tutorials/AnnotationOverlayEffect/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>9. <a href="http://www.steamdev.com/snippet/" target="_blank">Snippet – jQuery Syntax Highlighter</a></p>
<blockquote><p>Snippet是一个很酷的jQuery语法高亮插件，基于SHJS脚本，你可以在SourceForge上找到源码。</p>
<p><a href="http://www.steamdev.com/snippet/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>10. <a href="http://tutorialzine.com/2010/09/google-powered-site-search-ajax-jquery/" target="_blank">Google Powered Site Search With jQuery</a></p>
<blockquote><p>教你如何创建一个自定义的搜索引擎，只需要使用Google AJAX Search API，你可以搜索到您网站上的图片，视频和新闻等……</p>
<p><a href="http://demo.tutorialzine.com/2010/09/google-powered-site-search-ajax-jquery/search.html" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>11. <a href="http://www.sohtanaka.com/web-design/simple-tooltip-w-jquery-css/" target="_blank">简单的工具提示 – jQuery &amp; CSS</a></p>
<blockquote><p><a href="http://twitter.com/sohtanaka" target="_blank">Soh Tanaka</a> 创建一个简单的jQuery和CSS样式提示</p>
<p><a href="http://www.sohtanaka.com/web-design/examples/element-tooltip/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>12. <a href="http://tympanus.net/codrops/2010/10/03/compact-news-previewer/" target="_blank">Compact News Previewer with jQuery</a></p>
<blockquote><p>创建一个文章/新闻预览，以经凑的方式显示您最想的文章或新闻。预览工具将会显示一些关于文章更长的描述。</p>
<p><a href="http://tympanus.net/Tutorials/CompactNewsPreviewer/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>13. <a href="http://exposureforjquery.wordpress.com/download/" target="_blank">Exposure jQuery插件</a></p>
<blockquote><p>Exposure是一个图片预览插件，用于创建丰富，自定义的视觉体验。</p>
<p><a href="http://exposure.blogocracy.org/demos/demo1.html?v=0.5" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>14. <a href="http://tutorialzine.com/2010/09/giveaway-randomizer-app-jquery/" target="_blank">Giveaway Randomizer App – jQuery</a></p>
<blockquote><p>它会教你如何去创建一个jQuery专用的随机数发生器。</p>
<p><a href="http://demo.tutorialzine.com/2010/09/giveaway-randomizer-app-jquery/randomizer.html" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>15. <a href="http://www.webdesign-bulgaria.com/opensource/jquery-smooth-fading-tabs-plugin.php" target="_blank">jQuery Smooth Tabs Plugin</a></p>
<blockquote><p>jQuery Smooth Tabs是一个简单易于使用的插件，可以让你选择一些漂亮的效果来显示你的文字内容，带来更好的用户体验。</p>
<p><a href="http://www.webdesign-bulgaria.com/opensource/jquery-smooth-fading-tabs-demo.php" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>16. <a href="http://www.tn34.de/projekte/downloads/jQuery.tn34.timetabs.html" target="_blank">TN34 Timetabs – jQuery Plugin</a></p>
<blockquote><p>Mario Alves创建的一个tab容器的jQuery插件，可以选定不一样的样式来显示下一个tab。下载插件：<a href="http://plugins.jquery.com/project/tn34-timetabs" target="_blank">HERE</a>.</p>
<p><a href="http://demo.tn34.de/jquery-plugins/timetabs/demo.html" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>17. <a href="http://tympanus.net/codrops/2010/09/08/full-page-image-gallery/" target="_blank">Full Page Image Gallery with jQuery</a></p>
<blockquote><p>创建一个效果惊人的滚动缩略图和滚动全屏预览的画廊。</p>
<p><a href="http://tympanus.net/Tutorials/FullPageImageGallery/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>18. <a href="http://www.ajaxblender.com/bgstretcher-jquery-stretch-background-plugin.html" target="_blank">bgStretcher – jQuery Plugin</a></p>
<blockquote><p>Background Stretcher可以让你在背景中添加一个或多个大尺寸的图片，并调整他们的大小来填满整个页面，多张图片时会以幻灯片的形式出现。</p>
<p><a href="http://www.ajaxblender.com/script-sources/bgstretcher/demo/index.html" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>19. <a href="http://slidenote.info/" target="_blank">SlideNote – jQuery插件（滑动通</a><a href="http://slidenote.info/" target="_blank">知</a><a href="http://slidenote.info/" target="_blank">）</a></p>
<blockquote><p><a href="http://slidenote.info/" target="_blank"></a>SlideNote 是一个自定义，扩展性很强的jQuery插件，可以轻松的在网页或你的web应用上创建滑动通知。</p>
<p><a href="http://slidenote.info/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<p>20. <a href="http://www.madeincima.eu/blog/jquery-plugin-easy-list-splitter/" target="_blank">Easy List Splitter – jQuery插件</a></p>
<blockquote><p>Easy List Splitter插件将获取到的list和wrap装入一个container div，生成相应的列表项，并且生成一个有效的HTML代码。</p>
<p><a href="http://www.madeincima.eu/samples/jquery/easyListSplitter/" target="_blank">View Demo</a>（查看示例）</p></blockquote>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/03/45-fresh-useful-javascript-and-jquery-techniques-and-tools/" title="[英,转]45个新鲜有用的JS与jQuery技术和工具">[英,转]45个新鲜有用的JS与jQuery技术和工具</a></li><li><a href="http://slj.me/2010/01/10%e4%b8%aajquery-lightbox%e6%95%88%e6%9e%9c%e6%8f%92%e4%bb%b6/" title="10个jQuery Lightbox效果插件">10个jQuery Lightbox效果插件</a></li><li><a href="http://slj.me/2009/12/lazyload/" title="LazyLoad &#8211; jQuery延迟载入插件">LazyLoad &#8211; jQuery延迟载入插件</a></li><li><a href="http://slj.me/2009/12/20-more-beautiful-interactive-website-design-using-jquery/" title="20多个漂亮的使用jQuery交互的网站设计欣赏">20多个漂亮的使用jQuery交互的网站设计欣赏</a></li><li><a href="http://slj.me/2009/12/the-best-jquery-plugins-of-2009/" title="2009 年度最佳 jQuery 插件">2009 年度最佳 jQuery 插件</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/10/20-jquery-new-effects/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>关于几种文本替换技术－CSS3, sIFR, Typeface.js, cufon</title>
		<link>http://slj.me/2010/07/font-replacement-css3-sifr-typeface-js-cufon/</link>
		<comments>http://slj.me/2010/07/font-replacement-css3-sifr-typeface-js-cufon/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 08:53:39 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[cufon]]></category>
		<category><![CDATA[font replacement]]></category>
		<category><![CDATA[sifr]]></category>
		<category><![CDATA[Typeface]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1936</guid>
		<description><![CDATA[在现今的开发中，客户对页面中字体的显示效果越来越重视，尤其是标题文字。以往采用的方法是使用静态图片，但因为图片中文字不是动态的，采用一种新的方式尤为重要，下面是4种文字替代技术。 方案一：@font-face (CSS3样式) CSS3的@font-face属性（事实上CSS2中就已引入），为我们带来了一些希望，而Firefox 3.5新增的对@font-face的支持，让我们离这个希望更进了一些。 到现在为止，已经有Safari、Chrome、Opera 10和Firefox 3.5支持@font-face了，比较意外的是，IE系列浏览器也部分支持该属性。Mozilla旗下的其它产品，SeaMonkey 2 和Thunderbird 3 也支持该属性。 浏览器 最低版本 支持字体 Internet Explorer 4.0 只支持OpenType字体(eof格式) Firefox (Gecko) 3.5 (1.9.1) TrueType(ttf格式)和OpenType 字体 Opera 10.0 TrueType和OpenType 字体 Safari (WebKit) 3.1 (525) TrueType和OpenType 字体 从表中可以看出，IE系浏览器不支持TTF格式的字体，只支持eof格式，不过，微软官方发布了一个WEFT工具，可以将TTF转化为EOF，需要的朋友可以去下载使用。 可以使用的样式如下： @font-face　{ font-family: MyHelvetica; src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), url(MgOpenModernaBold.ttf); font-weight: bold; font-style:　normal; } .fontFace{ font-family: MyHelvetica; src: local("Helvetica [...]]]></description>
			<content:encoded><![CDATA[<p><img height="260" width="595" alt="" src="http://slj.me/wp-content/uploads/2010/07/font_replacement_post_thumb.png" class="thumb"/><br />
在现今的开发中，客户对页面中字体的显示效果越来越重视，尤其是标题文字。以往采用的方法是使用静态图片，但因为图片中文字不是动态的，采用一种新的方式尤为重要，下面是4种文字替代技术。</p>
<p><span id="more-1936"></span></p>
<h3>方案一：@font-face (CSS3样式)</h3>
<p>CSS3的@font-face属性（事实上CSS2中就已引入），为我们带来了一些希望，而Firefox 3.5新增的对@font-face的支持，让我们离这个希望更进了一些。</p>
<p>到现在为止，已经有Safari、Chrome、Opera 10和<a rel="external nofollow" href="https://developer.mozilla.org/index.php?title=En/CSS/%40font-face">Firefox 3.5支持@font-face</a>了，比较意外的是，IE系列浏览器也部分支持该属性。Mozilla旗下的其它产品，SeaMonkey 2 和Thunderbird 3 也支持该属性。<span id="more-1092"> </span></p>
<table style="height: 109px;" width="441">
<tbody>
<tr>
<td>浏览器</td>
<td>最低版本</td>
<td>支持字体</td>
</tr>
<tr>
<td>Internet Explorer</td>
<td>4.0</td>
<td>只支持OpenType字体(eof格式)</td>
</tr>
<tr>
<td>Firefox (Gecko)</td>
<td>3.5 (1.9.1)</td>
<td>TrueType(ttf格式)和OpenType 字体</td>
</tr>
<tr>
<td>Opera</td>
<td>10.0</td>
<td>TrueType和OpenType 字体</td>
</tr>
<tr>
<td>Safari (WebKit)</td>
<td>3.1 (525)</td>
<td>TrueType和OpenType 字体</td>
</tr>
</tbody>
</table>
<p>从表中可以看出，IE系浏览器不支持TTF格式的字体，只支持eof格式，不过，微软官方发布了一个WEFT工具，可以将TTF转化为EOF，需要的朋友可以去下载使用。</p>
<p>可以使用的样式如下：</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers"></td>
<td class="code">
<pre class="css" style="font-family: monospace;"><span style="color: #a1a100;">@font-face　{</span>
  <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00aa00;">:</span> MyHelvetica<span style="color: #00aa00;">;</span>
  src<span style="color: #00aa00;">:</span> local<span style="color: #00aa00;">(</span><span style="color: #ff0000;">"Helvetica Neue Bold"</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">,</span>
  local<span style="color: #00aa00;">(</span><span style="color: #ff0000;">"HelveticaNeue-Bold"</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">,</span>
  <span style="color: #993333;">url</span><span style="color: #00aa00;">(</span><span style="color: #ff0000; font-style: italic;">MgOpenModernaBold.ttf</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00aa00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00aa00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00aa00;">:</span>　<span style="color: #993333;">normal</span><span style="color: #00aa00;">;</span>
<span style="color: #00aa00;">}</span>
.fontFace<span style="color: #00aa00;">{</span>
  <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00aa00;">:</span> MyHelvetica<span style="color: #00aa00;">;</span>
  src<span style="color: #00aa00;">:</span> local<span style="color: #00aa00;">(</span><span style="color: #ff0000;">"Helvetica Neue Bold"</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">,</span>
  local<span style="color: #00aa00;">(</span><span style="color: #ff0000;">"HelveticaNeue-Bold"</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">,</span>
  <span style="color: #993333;">url</span><span style="color: #00aa00;">(</span><span style="color: #ff0000; font-style: italic;">MgOpenModernaBold.ttf</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00aa00;">:</span>　<span style="color: #933;">3.2em</span><span style="color: #00aa00;">;</span>
  <span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00aa00;">:</span>　<span style="color: #933;">1px</span><span style="color: #00aa00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00aa00;">:</span>　<span style="color: #993333;">center</span><span style="color: #00aa00;">;</span>
<span style="color: #00aa00;">}</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>IE中的样式如下：</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers"></td>
<td class="code">
<pre class="css" style="font-family: monospace;"><span style="color: #a1a100;">@font-face　{</span>
　　<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00aa00;">:</span>　Goudy　Stout<span style="color: #00aa00;">;</span>
　　<span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00aa00;">:</span>　<span style="color: #993333;">normal</span><span style="color: #00aa00;">;</span>
　　<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00aa00;">:</span>　<span style="color: #cc66cc;">400</span><span style="color: #00aa00;">;</span>
　　src<span style="color: #00aa00;">:</span>　<span style="color: #993333;">url</span><span style="color: #00aa00;">(</span>GOUDYST0.eot<span style="color: #00aa00;">)</span><span style="color: #00aa00;">;</span>
<span style="color: #00aa00;">}</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<blockquote><p>相关链接：</p>
<ul>
<li> <a rel="external nofollow" href="https://developer.mozilla.org/index.php?title=En/CSS/%40font-face">https://developer.mozilla.org/index.php?title=En/CSS/%40font-face</a></li>
<li> <a rel="external nofollow" href="http://www.css3.info/preview/web-fonts-with-font-face/">Web fonts with @font-face :http://www.css3.info/preview/web-fonts-with-font-face/</a></li>
</ul>
</blockquote>
<h3>方案二：sIFR (Scalable Inman Flash Replacement)</h3>
<p>sIFR并非一种新技术，而是已经存在并被使用很多年了。sIFR是一种很有用也很好用的文本替换技术，通过Flash+JS+CSS将网络字体嵌入到页面中。</p>
<ul>
<li>sIFR 是一种用Flash替换页面中文本元素的技术。</li>
<li>sIFR利用了Flash的dynamic text和character embedded这个功能实现。</li>
</ul>
<p>关于sIFR的一些事实：</p>
<ul>
<li> sIFR不需要更改(X)HTML代码，所有的工作由Javascript、Flash和CSS来完成；</li>
<li> 如果用户没有安装Flash或者不支持Javascript，那么(X)HTML的文本就会被CSS样式化后显示出来。</li>
<li> sIFR是可缩放的，可以在渲染时更改为用户设置的缺省字体尺寸。</li>
<li> sIFR兼容所有的屏幕阅读机，至今还没有问题被报道出来。</li>
<li> sIFR的文本可以被鼠标选择，尽管当全选文本时，选中的状态看上去不那么确切。</li>
<li> sIFR不影响搜索引擎的定位和评定，不会隐藏真实的文本内容。</li>
</ul>
<p>在链接上使用sIFR</p>
<p>最新版本的sIFR允许链接文本被替换。但可能造成以下的可访问性问题：</p>
<ul>
<li>不支持浏览器的右键点击功能（上下文菜单）</li>
<li>不支持apple的option键</li>
<li>没有状态条信息</li>
</ul>
<p>使用步骤：</p>
<ol>
<li>包含所需的js和css:
<div class="wp_syntax">
<table style="height: 92px;" width="585">
<tbody>
<tr>
<td class="line_numbers"></td>
<td class="code">
<pre class="html4strict" style="font-family: monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"all.css"</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"text/css"</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"all"</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"sIFR-screen.css"</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"text/css"</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"screen"</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"sIFR-print.css"</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"text/css"</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"print"</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"sifr.js"</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"text/javascript"</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"sifr-addons.js"</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"text/javascript"</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</li>
<li>执行代码:
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers"></td>
<td class="code">
<pre class="javascript" style="font-family: monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366cc;">"text/javascript"</span><span style="color: #339933;">&gt;</span>
<span style="color: #006600; font-style: italic;">//&lt;![CDATA[</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">(</span><span style="color: #000066; font-weight: bold;">typeof</span> sIFR <span style="color: #339933;">==</span> <span style="color: #3366cc;">"function"</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span>
<span style="color: #006600; font-style: italic;">// 建议用这种格式</span>
    sIFR.<span style="color: #660066;">replaceElement</span><span style="color: #009900;">(</span>named<span style="color: #009900;">(</span><span style="color: #009900;">{</span>sSelector<span style="color: #339933;">:</span><span style="color: #3366cc;">"body h1"</span><span style="color: #339933;">,</span> sFlashSrc<span style="color: #339933;">:</span><span style="color: #3366cc;">"vandenkeere.swf"</span><span style="color: #339933;">,</span> sColor<span style="color: #339933;">:</span><span style="color: #3366cc;">"#000000"</span><span style="color: #339933;">,</span> sLinkColor<span style="color: #339933;">:</span><span style="color: #3366cc;">"#000000"</span><span style="color: #339933;">,</span> sBgColor<span style="color: #339933;">:</span><span style="color: #3366cc;">"#FFFFFF"</span><span style="color: #339933;">,</span> sHoverColor<span style="color: #339933;">:</span><span style="color: #3366cc;">"#CCCCCC"</span><span style="color: #339933;">,</span> nPaddingTop<span style="color: #339933;">:</span><span style="color: #cc0000;">20</span><span style="color: #339933;">,</span> nPaddingBottom<span style="color: #339933;">:</span><span style="color: #cc0000;">20</span><span style="color: #339933;">,</span> sFlashVars<span style="color: #339933;">:</span><span style="color: #3366cc;">"textalign=center&amp;offsetTop=6"</span><span style="color: #009900;">}</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// 这种格式也可以，但参数的顺序就必须按照指定的顺序写，没有的参数用null表示。</span>
    sIFR.<span style="color: #660066;">replaceElement</span><span style="color: #009900;">(</span><span style="color: #3366cc;">"h5#pullquote"</span><span style="color: #339933;">,</span> <span style="color: #3366cc;">"vandenkeere.swf"</span><span style="color: #339933;">,</span> <span style="color: #3366cc;">"#000000"</span><span style="color: #339933;">,</span> <span style="color: #3366cc;">"#000000"</span><span style="color: #339933;">,</span> <span style="color: #3366cc;">"#FFFFFF"</span><span style="color: #339933;">,</span> <span style="color: #3366cc;">"#FFFFFF"</span><span style="color: #339933;">,</span> <span style="color: #cc0000;">0</span><span style="color: #339933;">,</span> <span style="color: #cc0000;">0</span><span style="color: #339933;">,</span> <span style="color: #cc0000;">0</span><span style="color: #339933;">,</span> <span style="color: #cc0000;">0</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
    sIFR.<span style="color: #660066;">replaceElement</span><span style="color: #009900;">(</span><span style="color: #3366cc;">"h3"</span><span style="color: #339933;">,</span> <span style="color: #3366cc;">"tradegothic.swf"</span><span style="color: #339933;">,</span> <span style="color: #3366cc;">"#000000"</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #cc0000;">0</span><span style="color: #339933;">,</span> <span style="color: #cc0000;">0</span><span style="color: #339933;">,</span> <span style="color: #cc0000;">0</span><span style="color: #339933;">,</span> <span style="color: #cc0000;">0</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #009900;">}</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">//]]&gt;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</li>
</ol>
<p>sIFR.replaceElement函数的参数 </p>
<ul>
<li>sSelector<br />
  <span lang="EN-US">CSS selector </span><span>，使用这个选择器选择需要替换的文本元素。支持的选择器包括</span> <span lang="EN-US">ID</span><span>选择器（</span><span lang="EN-US">#</span><span>）</span><span lang="EN-US">,</span><span>子代选择器（</span><span lang="EN-US">&gt;</span><span>）和类选择器（</span><span lang="EN-US">.</span><span>）。</span> <span>多个选择器可以用逗号隔开。如：</span><span lang="EN-US">“body h1″</span><span>，</span><span lang="EN-US">“h5#pullquote”</span><span>，</span><span lang="EN-US">“h3.sidebox”</span><span>，</span><span lang="EN-US">“h3″</span><span>等等。</span></li>
<li>sFlashSrc<br />
  <span>嵌入字符的</span><span lang="EN-US">swf</span><span>文件的位置。</span></li>
<li><span lang="EN-US">sColor<br />
  </span><span>文本颜色。如</span><span lang="EN-US"> (#000000).</span></li>
<li>sLinkColor<br />
  链接的文本颜色</li>
<li>sHoverColor<br />
  <span lang="EN-US">hovered links</span><span>的颜色</span><span lang="EN-US">.</span></li>
<li>sBgColor<br />
  <span>背景色。</span></li>
<li><span lang="EN-US">nPaddingTop<br />
  </span><span>上部填充。单位</span><span lang="EN-US">pixels, </span><span>但不要写</span><span lang="EN-US"> px</span><span>部分。</span></li>
<li>nPaddingRight<br />
  右填充</li>
<li>nPaddingBottom<br />
  底部填充</li>
<li>nPaddingLeft<br />
  左填充</li>
<li>sFlashVars<br />
  <span>传递给</span><span lang="EN-US">Flash</span><span>的参数。参数间用</span><span lang="EN-US">&amp;</span><span>分隔。</span><span>如下可以使用下面这些参数：</span><span lang="EN-US"> </span> <span lang="EN-US">textalign=center: </span><span>水平居中</span> <span lang="EN-US">offsetLeft=5: </span><span>距离左边</span><span lang="EN-US">5px </span> <span lang="EN-US">offsetTop=5: </span><span>距离上边</span><span lang="EN-US">5px</span> <span lang="EN-US">underline=true: </span><span>对</span><span lang="EN-US">hover</span><span>的链接添加下划线</span></li>
<li>sCase<br />
  <span>等于</span><span lang="EN-US">upper</span><span>可以变成大写；等于</span><span lang="EN-US">lower </span><span>转换成小写。</span></li>
<li>sWmode<br />
  <span>将该参数设置成</span><span lang="EN-US"> transparent </span><span>，可以使背景透明。如果希望元素叠放在</span><span lang="EN-US">Flash</span><span>上，则应设置成</span><code><span lang="EN-US">opaque</span></code></li>
</ul>
<p>总结</p>
<ul>
<li>sIFR并不会和图片替换技术相竞争；它是针对不同工作的独特的工具。它能被最好的使用在那些显示为浏览器缺省字体大小的，而又不能替换为自建图片的文本上。</li>
<li>sIFR理想的使用场合是，当你想要仅用一张图片就显示自定义的字体或者反锯齿的标题时。这在web上被非常频繁的使用，在这些案例中sIFR是一个更好的选择。它可以缩放为用户缺省的字体尺寸，可以被选择，可以使用在数以千计的页面上而只需要下载一两个文件。</li>
</ul>
<p>摘要</p>
<ul>
<li>在页面标题上使用sIFR。</li>
<li>有限度的使用sIFR，以获得最佳的下载时间。</li>
<li>不要在链接上使用sIFR。</li>
</ul>
<p>相关链接：</p>
<ul>
<li><a rel="external nofollow" href="http://dev.novemberborn.net/sifr3/nightlies/">sIFR 3版本：http://wiki.novemberborn.net/sifr3/</a></li>
<li><a rel="external nofollow" href="http://wiki.novemberborn.net/sifr3/">sIFR 3文档： http://wiki.novemberborn.net/sifr3/</a></li>
<li><a rel="external nofollow" href="http://www.mikeindustries.com/blog/sifr/">Mike Davidson  –  sIFR: http://www.mikeindustries.com/blog/sifr/</a></li>
<li><a rel="external nofollow" href="http://baike.baidu.com/view/1311052.htm">sIFR – 百度百科: http://baike.baidu.com/view/1311052.htm</a></li>
<li><a rel="external nofollow" href="http://guowushi54.blog.163.com/blog/static/203582220071123112455818/">sIFR-文本替换技术: http://guowushi54.blog.163.com/blog/static/203582220071123112455818/</a></li>
<li><a rel="external nofollow" href="http://www.w3cn.org/article/translate/2005/117.html">如何以及何时使用sIFR: http://www.w3cn.org/article/translate/2005/117.html</a></li>
</ul>
<h3>方案三：Typeface.js</h3>
<p>Typeface被认为是替代SIFR的最佳方案，相对于sIFR，Typeface少了Flash的应用，使用纯JS来嵌入相关字体，而且用法也很简单：在页面中引入相应的js文件就可以。</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers"></td>
<td class="code">
<pre class="html4strict" style="font-family: monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
　<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--加载所有的样式先--&gt;</span>
　　<span style="color: #009900;">&lt;link　<span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"stylesheet"</span>　<span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"text/css"</span>　ref<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"/style.css"</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--再加载typeface.js　库文件和typeface.js字体文件--&gt;</span>
　　<span style="color: #009900;">&lt;script　<span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"text/javascript"</span>　<span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"typeface-0.10.js"</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
　　<span style="color: #009900;">&lt;script　<span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"text/javascript"</span>　<span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"helvetiker_regular.typeface.js"</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
　<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
　<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--继续并使用CSS指定typeface.js字体--&gt;</span>
　　<span style="color: #009900;">&lt;div　<span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"myclass　typeface-js"</span>　<span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"font-family:　Helvetiker"</span>&gt;</span>
　　　文本文本...
　　<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
　<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>相关链接：</p>
<ul>
<li> <a href="http://typeface.neocracy.org/">typeface: http://typeface.neocracy.org/</a></li>
</ul>
<h3>方案四：cufon</h3>
<p>cufon是一个比较新的技术，被定位为有价值的sIFR替代方案，它有很多优势：</p>
<ul>
<li>无需浏览器插件——被浏览器原生支持；</li>
<li>兼容性——兼容各个主流浏览器</li>
<li>易用—— 无需配置</li>
<li>速度—— 快速渲染大量字体</li>
</ul>
<p>cufon和typeface.js对比</p>
<table>
<tbody>
<tr>
<td width="151"></td>
<td width="429">Cufón</td>
<td width="439">Typeface.js</td>
</tr>
<tr>
<td><strong>File size</strong></td>
<td>14.0kb (压缩后)</td>
<td>16.3kb (未压缩)</td>
</tr>
<tr>
<td><strong>支持的浏览器</strong></td>
<td>Firefox 1.5+, Safari 3+, Opera 9.5+, Google Chrome 和 Internet Explorer6+</td>
<td>Firefox 1.5+, Safari 2+, and Internet Explorer 6+, 最新版已经支持IE8</td>
</tr>
<tr>
<td><strong>支持的字体类型</strong></td>
<td>.ttf, .otf, PFB, postscript</td>
<td>.ttf</td>
</tr>
<tr>
<td><strong>支持的字体样式</strong></td>
<td>font-size, font-style, font-weight, line-height, text-shadow, color</td>
<td>font-size, font-style, font-weight, font-stretch, letter-spacing, line-height</td>
</tr>
<tr>
<td><strong>可选文字?</strong></td>
<td>尚不支持</td>
<td>尚不支持</td>
</tr>
</tbody>
</table>
<p>cufon资源：</p>
<ul>
<li>cufon项目: <a href="http://wiki.github.com/sorccu/cufon/about" target="_blank">http://wiki.github.com/sorccu/cufon/about</a></li>
<li>cufon演示(列表): <a href="http://wiki.github.com/sorccu/cufon/demos" target="_blank">http://wiki.github.com/sorccu/cufon/demos</a></li>
<li>cufon生成器: <a href="http://cufon.shoqolate.com/generate/" target="_blank">http://cufon.shoqolate.com/generate/</a></li>
<li>wp-cufon: <a href="http://wordpress.org/extend/plugins/wp-cufon/" target="_blank">一个使用cufon的wordpress插件  http://wordpress.org/extend/plugins/wp-cufon/</a></li>
<li><a href="http://stackoverflow.com/questions/692990/sifr-vs-cufon-vs-typeface-js" target="_blank">Typeface.js VS sIFR VS cufon: http://stackoverflow.com/questions/692990/sifr-vs-cufon-vs-typeface-js</a></li>
</ul>
<p>相关链接：</p>
<ul>
<li><a href="http://wiki.github.com/sorccu/cufon/about" target="_blank">cufon 文档: http://wiki.github.com/sorccu/cufon/about</a></li>
</ul>
<p>综述：</p>
<p>事实上，sIFR、typeface.js和cufon都是目前常说的文本替换技术，这些技术都可以用来替换@font-face，并且实现更好的浏览器兼容性。但是每种技术都不是完美的：</p>
<p>@font-face最简单，虽然大部分浏览器也都支持了，但是其浏览器兼容性并不是很完美，对IE还需要eof字体的特殊支持，而且对于中文字体来说，一般都很大，这会占用很大的页面加载时间和服务器流量。</p>
<p>sIFR是兼容性和可用性最好、对SEO友好的一种方案，但也是实现起来最复杂的，而且需要浏览器支持Flash插件。</p>
<p>typeface和cufon都是利用在IE中渲染VML，而在非IE浏览器中使用canvas的方式实现“伪”字体的，他们使用起来相对简单，但是可用性和用户体验以及SEO都不是很理想。</p>
<p>版权问题是一个很重要的问题，无论你使用哪种技术，都需要考虑文字的授权。</p>
<blockquote><p>注：</p>
<ul>
<li>部分资料收集于网络，纯属交流学习，有侵犯版权之处请联系我</li>
<li>欢迎贡献讨论关于 “文字替换技术” 的更多相关文章资料</li>
</ul>
</blockquote>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/03/css3-please-the-cross-browser-css3-rule-generator/" title="CSS3, Please! The Cross-Browser CSS3 Rule Generator">CSS3, Please! The Cross-Browser CSS3 Rule Generator</a></li><li><a href="http://slj.me/2009/12/html5-css3/" title="揭秘HTML5和CSS3">揭秘HTML5和CSS3</a></li><li><a href="http://slj.me/2009/12/pushing-your-buttons-with-practical-css3/" title="来用实用的CSS3来制作你的酷炫按钮吧">来用实用的CSS3来制作你的酷炫按钮吧</a></li><li><a href="http://slj.me/2009/05/scalable-inman-flash-replacement/" title="谈谈sIFR &#8211; 可伸缩Inman Flash替换">谈谈sIFR &#8211; 可伸缩Inman Flash替换</a></li><li><a href="http://slj.me/2009/04/css-3-the-future-shines-bright/" title="CSS 3 &#8211; 前途一片光明">CSS 3 &#8211; 前途一片光明</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/07/font-replacement-css3-sifr-typeface-js-cufon/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CSS中的RGBa色彩</title>
		<link>http://slj.me/2010/07/css-rgba/</link>
		<comments>http://slj.me/2010/07/css-rgba/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 06:25:02 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[rgba]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1920</guid>
		<description><![CDATA[RGBa是一种在CSS中声明包含透明效果的颜色的方法，它的语法是这样的： div { background: rgba(200, 54, 54, 0.5); } 它允许我们为元素添加透明色。或许我们习惯了使用”opacity“，它很简单易用，但是，opacity会使所有的子元素都变成透明的，而且很难去解决这个问题。 通过RGBa，我们可以将一个元素设置为透明，而不会影响其子元素： 声明一个保留颜色 并非所有的浏览器支持RGBa，所以如果允许的话，可以声明一个保留色彩。这个色彩应该是可靠的——所有的浏览器都支持。不声明就意味着，在不支持RGBa的浏览器里面，没有使用颜色。 div { background: rgb(200, 54, 54); /* The Fallback */ background: rgba(200, 54, 54, 0.5); }&#60;/code&#62; 不过，这条退路在某些古董级浏览器中依然无效。 RGBa的浏览器支持情况 浏览器，版本，操作系统 测试结果 退路 Firefox 3.0.5 (OS X, Windows XP, Vista) 支持 — Firefox 2.0.0.18 (PC) 不支持 纯色 Safari 4 (Developer Preview, Mac) 支持 — [...]]]></description>
			<content:encoded><![CDATA[<p><img height="260" width="595" alt="" src="http://slj.me/wp-content/uploads/2010/07/CSS-rgba_post_thumb.png" class="thumb"/><br />
RGBa是一种在CSS中声明包含透明效果的颜色的方法，它的语法是这样的：</p>
<p><span id="more-8091"> </span></p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
</pre>
</td>
<td class="code">
<pre class="css" style="font-family: monospace;">div <span style="color: #00aa00;">{</span>
   <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00aa00;">:</span> rgba<span style="color: #00aa00;">(</span><span style="color: #cc66cc;">200</span><span style="color: #00aa00;">,</span> <span style="color: #cc66cc;">54</span><span style="color: #00aa00;">,</span> <span style="color: #cc66cc;">54</span><span style="color: #00aa00;">,</span> <span style="color: #cc66cc;">0.5</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">;</span>
<span style="color: #00aa00;">}</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>它允许我们为元素添加透明色。或许我们习惯了使用”<em>opacity</em>“，它很简单易用，但是，opacity会使所有的子元素都变成透明的，而且很难去解决这个问题。</p>
<p><span id="more-1920"></span>通过RGBa，我们可以将一个元素设置为透明，而不会影响其子元素：</p>
<p><img src="http://slj.me/wp-content/uploads/2010/07/165017jqc.jpg" alt="" width="500" height="314" /></p>
<h3>声明一个保留颜色</h3>
<p>并非所有的浏览器支持RGBa，所以如果允许的话，可以声明一个保留色彩。这个色彩应该是<strong>可靠的</strong>——所有的浏览器都支持。不声明就意味着，在不支持RGBa的浏览器里面，没有使用颜色。</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
</pre>
</td>
<td class="code">
<pre class="css" style="font-family: monospace;">div <span style="color: #00aa00;">{</span>
   <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00aa00;">:</span> <span style="color: #993333;">rgb</span><span style="color: #00aa00;">(</span><span style="color: #cc66cc;">200</span><span style="color: #00aa00;">,</span> <span style="color: #cc66cc;">54</span><span style="color: #00aa00;">,</span> <span style="color: #cc66cc;">54</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">;</span> <span style="color: #808080; font-style: italic;">/* The Fallback */</span>
   <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00aa00;">:</span> rgba<span style="color: #00aa00;">(</span><span style="color: #cc66cc;">200</span><span style="color: #00aa00;">,</span> <span style="color: #cc66cc;">54</span><span style="color: #00aa00;">,</span> <span style="color: #cc66cc;">54</span><span style="color: #00aa00;">,</span> <span style="color: #cc66cc;">0.5</span><span style="color: #00aa00;">)</span><span style="color: #00aa00;">;</span>
<span style="color: #00aa00;">}</span>&lt;/code<span style="color: #00aa00;">&gt;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>不过，这条退路在某些古董级浏览器中依然无效。</p>
<h3>RGBa的浏览器支持情况</h3>
<table style="width: 100%; border-collapse: collapse;">
<tbody>
<tr>
<th style="padding: 4px 8px; font-weight: bold;">浏览器，版本，操作系统</th>
<th style="padding: 4px 8px; font-weight: bold;">测试结果</th>
<th style="padding: 4px 8px; font-weight: bold;">退路</th>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Firefox 3.0.5 (OS X, Windows XP, Vista)</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">—</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">Firefox 2.0.0.18 (PC)</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">纯色</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Safari 4 (Developer Preview, Mac)</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">—</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Safari 3.2.1 (PC)</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">—</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Mobile Safari (iPhone)</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">—</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">Opera 9.6.1</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">纯色</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">IE 5.5 (PC via IETester)</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">无色</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">IE 6 (PC via IETester)</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">纯色</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">IE 7</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">纯色</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">IE 8 beta 2</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">纯色</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Google Chrome 1.0.154.43</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">—</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Google Chrome 1.0.154.46</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">—</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">Netscape 4.8 (PC)</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">没有颜色</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">SeaMonkey 1.1.14</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">无色</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">SeaMonkey 1.1.16</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">纯色</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">SeaMonkey 2.0 beta3</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">—</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Sunrise 1.7.5</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">—</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Stainless 0.2.5</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">–</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">Flock 2.0.2</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">–</td>
</tr>
<tr class="works">
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">BlackBerry Storm Browser</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">支持</td>
<td style="background: #caf8c7; padding: 4px; border-bottom: 3px solid white;">纯色</td>
</tr>
<tr class="not">
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">Camino 1.6.6</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">不支持</td>
<td style="background: #f8c7c7; padding: 4px; border-bottom: 3px solid white;">纯色</td>
</tr>
</tbody>
</table>
<h3>对IE浏览器的更好的退路</h3>
<p>因为IE浏览器支持条件注释，我们可以抛弃RGB并使用IE的一个私有CSS滤镜来实现同样的效果：</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
</pre>
</td>
<td class="code">
<pre class="html4strict" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">&lt;!--[if IE]&gt;</span>
<span style="color: #808080; font-style: italic;">   &lt;style type="text/css"&gt;</span>
<span style="color: #808080; font-style: italic;">   .color-block {</span>
<span style="color: #808080; font-style: italic;">       background:transparent;</span>
<span style="color: #808080; font-style: italic;">       filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000050,endColorstr=#99000050);</span>
<span style="color: #808080; font-style: italic;">       zoom: 1;</span>
<span style="color: #808080; font-style: italic;">    } </span>
<span style="color: #808080; font-style: italic;">    &lt;/style&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>RGBa颜色可以用于border，不过，不同的浏览器对于border的RGBa支持不太一样，不过唯一的不同是，FF在border的拐角处会出现叠加，比如透明度是0.4，那么在FF中，四个角的透明度会变成0.8，而支持RGBa的<strong>非FF浏览器</strong>不会出现这种情况。</p>
<p><a href="http://css-tricks.com/rgba-browser-support/" target="_blank">转载：css-tricks</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/05/html5-new-features/" title="HTML5新功能演示">HTML5新功能演示</a></li><li><a href="http://slj.me/2010/04/%e7%94%a8css%e4%bf%ae%e6%ad%a3%e4%b8%80%e5%88%87%ef%bc%9a20%e5%a4%9a%e4%b8%aa%e5%b8%b8%e8%a7%81bug%e5%8f%8a%e5%85%b6%e4%bf%ae%e6%ad%a3%e6%96%b9%e6%b3%95/" title="用CSS修正一切：20多个常见Bug及其修正方法">用CSS修正一切：20多个常见Bug及其修正方法</a></li><li><a href="http://slj.me/2010/03/ultimate-guide-css-text-typography/" title="[转]CSS文字排版终极指南">[转]CSS文字排版终极指南</a></li><li><a href="http://slj.me/2010/03/building-iphone-apps-with-html-css-and-javascript/" title="【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript">【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript</a></li><li><a href="http://slj.me/2009/12/tx-qzone-rounded-avatar-css/" title="研究腾讯Qzone圆角头像CSS有感">研究腾讯Qzone圆角头像CSS有感</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/07/css-rgba/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML5新功能演示</title>
		<link>http://slj.me/2010/05/html5-new-features/</link>
		<comments>http://slj.me/2010/05/html5-new-features/#comments</comments>
		<pubDate>Sat, 01 May 2010 10:34:18 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1728</guid>
		<description><![CDATA[这是一个HTML5新功能的演示文档，几乎包括HTML5所有激动人心的新功能的简介和DEMO。 IE系列浏览器无法浏览，firefox、opera等浏览器只能使用部分功能，如果想100%演示成功，请使用最新版的“谷歌浏览器（Google Chrome）”，建议使用最新版。 中文原版：http://directguo.com/html5/ 中文镜像：http://ioio.name/html5/html5_zh_CN.html 英文原版：http://apirocks.com/html5/html5.html 英文镜像：http://ioio.name/html5/html5.html Related Posts / 相关文章揭秘HTML5和CSS3【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript转牛X无敌！！！Zen Coding: 一种快速编写HTML/CSS代码的方法关于一些浏览器的的HackCSS中的RGBa色彩]]></description>
			<content:encoded><![CDATA[<p><img class="thumb" src="http://slj.me/wp-content/uploads/2010/05/html5_post_thumb.png" alt="HTML5新功能演示" width="595" height="260" /></p>
<p>这是一个HTML5新功能的演示文档，几乎包括HTML5所有激动人心的新功能的简介和DEMO。<br />
IE系列浏览器无法浏览，firefox、opera等浏览器只能使用部分功能，如果想100%演示成功，请使用最新版的“谷歌浏览器（Google Chrome）”，建议使用最新版。<br />
<span id="more-1728"></span><br />
<img class="alignnone size-full wp-image-1729" title="intohtml5-300x231" src="http://slj.me/wp-content/uploads/2010/05/intohtml5-300x231.gif" alt="" width="300" height="231" /></p>
<p>中文原版：<a href="http://directguo.com/html5/" target="_blank">http://directguo.com/html5/</a><br />
中文镜像：<a href="http://ioio.name/html5/html5_zh_CN.html" target="_blank">http://ioio.name/html5/html5_zh_CN.html</a><br />
英文原版：<a href="http://apirocks.com/html5/html5.html" target="_blank">http://apirocks.com/html5/html5.html</a><br />
英文镜像：<a href="http://ioio.name/html5/html5.html" target="_blank">http://ioio.name/html5/html5.html</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2009/12/html5-css3/" title="揭秘HTML5和CSS3">揭秘HTML5和CSS3</a></li><li><a href="http://slj.me/2010/03/building-iphone-apps-with-html-css-and-javascript/" title="【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript">【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript</a></li><li><a href="http://slj.me/2009/12/%e7%89%9bx%e6%97%a0%e6%95%8c%ef%bc%81%ef%bc%81%ef%bc%81zen-coding-%e4%b8%80%e7%a7%8d%e5%bf%ab%e9%80%9f%e7%bc%96%e5%86%99htmlcss%e4%bb%a3%e7%a0%81%e7%9a%84%e6%96%b9%e6%b3%95/" title="转牛X无敌！！！Zen Coding: 一种快速编写HTML/CSS代码的方法">转牛X无敌！！！Zen Coding: 一种快速编写HTML/CSS代码的方法</a></li><li><a href="http://slj.me/2009/03/browser_css_hack_ie_ff/" title="关于一些浏览器的的Hack">关于一些浏览器的的Hack</a></li><li><a href="http://slj.me/2010/07/css-rgba/" title="CSS中的RGBa色彩">CSS中的RGBa色彩</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/05/html5-new-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用CSS修正一切：20多个常见Bug及其修正方法</title>
		<link>http://slj.me/2010/04/%e7%94%a8css%e4%bf%ae%e6%ad%a3%e4%b8%80%e5%88%87%ef%bc%9a20%e5%a4%9a%e4%b8%aa%e5%b8%b8%e8%a7%81bug%e5%8f%8a%e5%85%b6%e4%bf%ae%e6%ad%a3%e6%96%b9%e6%b3%95/</link>
		<comments>http://slj.me/2010/04/%e7%94%a8css%e4%bf%ae%e6%ad%a3%e4%b8%80%e5%88%87%ef%bc%9a20%e5%a4%9a%e4%b8%aa%e5%b8%b8%e8%a7%81bug%e5%8f%8a%e5%85%b6%e4%bf%ae%e6%ad%a3%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 17:10:33 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[Hack]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1695</guid>
		<description><![CDATA[毫无疑问，一个合理的布局和结构是最好选择。这不仅是因为你的布局在不同浏览器见表现不同，而且还因为的CSS有很多方法来布局你的每个元素。今天，我们希望与你们分享一些避免在创建CSS布局时容易遇到的错误的技巧。 IE Bug修正 1- Bug修正：IE双倍Margin bug - 元素是浮动的-并且给元素一个和浮动同一个方向的margin-结果显示两倍的指定margin大小。这个方法非常简单。所有您需要做的就是添加一个display: inline规则到你的浮动元素。所以，你只是把例如这样的代码： #content { float: left; width: 500px; padding: 10px 15px; margin-left: 20px; } 改为如下代码 : #content { float: left; width: 500px; padding: 10px 15px; margin-left: 20px; display:inline; } 2- 克服盒模型hack - 如果你想给任一div指定宽度，不要指定padding或margin。只要另建一个内部(嵌套)的没有宽度的div并设定其padding和margin来替代。所以，不要这样做： #main-div{ width: 150px; border: 5px; padding: 20px; } 这样做: #main-div{ width: 150px; } #main-div div{ [...]]]></description>
			<content:encoded><![CDATA[<p><img height="260" width="595" src="http://slj.me/wp-content/uploads/2010/04/css_fix_everything_post_thumb.png" alt="用CSS修正一切：20多个常见Bug及其修正方法" class="thumb"/></p>
<p>毫无疑问，一个合理的布局和结构是最好选择。这不仅是因为你的布局在不同浏览器见表现不同，而且还因为的CSS有很多方法来布局你的每个元素。今天，我们希望与你们分享一些避免在创建CSS布局时容易遇到的错误的技巧。</p>
<p><span id="more-1695"></span></p>
<h3>IE Bug修正</h3>
<h3><a rel="external nofollow" href="http://www.cssnewbie.com/double-margin-float-bug/">1- Bug修正：IE双倍Margin bug</a></h3>
<p>- 元素是浮动的-并且给元素一个和浮动同一个方向的margin-结果显示两倍的指定margin大小。这个方法非常简单。所有您需要做的就是添加一个display: inline规则到你的浮动元素。所以，你只是把例如这样的代码：</p>
<pre><code>#content {
    float: left;
    width: 500px;
    padding: 10px 15px;
    margin-left: 20px; }</code></pre>
<p>改为如下代码 :</p>
<pre><code>#content {
    float: left;
    width: 500px;
    padding: 10px 15px;
    margin-left: 20px;
    display:inline;
}</code></pre>
<p><a rel="external nofollow" href="http://www.cssnewbie.com/double-margin-float-bug/"><img src="http://slj.me/wp-content/uploads/2010/04/184446r0i.gif" alt="CSS Tips" /></a></p>
<p><!--more--></p>
<hr />
<h3>2- 克服盒模型hack</h3>
<p>- 如果你想给任一div指定宽度，不要指定padding或margin。只要另建一个内部(嵌套)的没有宽度的div并设定其padding和margin来替代。所以，不要这样做：</p>
<pre><code>#main-div{
width: 150px;
border: 5px;
padding: 20px;
}</code></pre>
<p>这样做:</p>
<pre><code>#main-div{
width: 150px;
}
#main-div div{
border: 5px;
padding: 20px;
}</code></pre>
<hr />
<h3>3-<a rel="external nofollow" href="http://www.cssplay.co.uk/boxes/minheight.html">IE无视min-height属性</a></h3>
<p>- min-height属性在firefox下表现很好但是IE却无视了它，IE的height就像FF的min-height.注意：IE7没有这个bug。</p>
<pre><code>/* 对主流浏览器 */
.container {
width:20em;
padding:0.5em;
border:1px solid #000;
min-height:8em;
height:auto;
}
/* 对IE浏览器 */
/*\*/
* html .container {
height: 8em;
}
/**/</code></pre>
<h3>4-?<a rel="external nofollow" href="http://www.cssplay.co.uk/boxes/minwidth.html">Min-Width for IE</a></h3>
<p>-一个IE的min-width缺陷的修正。</p>
<hr />
<h3>块级元素居中</h3>
<h3>5-<a rel="external nofollow" href="http://css-discuss.incutio.com/?page=CenteringBlockElement">块级元素居中</a></h3>
<p>- 有很多种方法可以使块级元素居中；选择哪种方法取决于你的百分比大小设置或使用更绝对的数值。</p>
<p>整个页面内容居中：</p>
<pre><code>body{
text-align: center;
}
#container
{
text-align: left;
width: 960px;
margin: 0 auto;
}</code></pre>
<hr />
<h3>6-<a rel="external nofollow" href="http://www.badboy.ro/articles/2005-02-20/vertical_align_with_css/">使用CSS垂直对齐</a></h3>
<p>- 如果你想知道怎么才能正确的实现垂直对齐，只需要简单的为你的文本指定和容器等高的line-height。</p>
<pre><code>#wrapper {
	width:530px;
	height:25px;
	background:url(container.gif) no-repeat left top;
	padding:0px 10px;
}
#wrapper p {
	line-height:25px;
}</code></pre>
<hr />
<h3>栏目问题</h3>
<h3>7-?<a rel="external nofollow" href="http://warpspire.com/tipsresources/web-production/css-column-tricks/">你的CSS栏目被搞乱的最大原因</a></h3>
<p>-一个容易理解的就如何解决普遍的CSS栏目的问题的有用的图解和代码片断的文章.</p>
<p><a rel="external nofollow" href="http://warpspire.com/tipsresources/web-production/css-column-tricks/"><img src="http://slj.me/wp-content/uploads/2010/04/184446pba.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>8-?<a rel="external nofollow" href="http://www.positioniseverything.net/explorer/expandingboxbug.html">扩大的盒子Bug</a></h3>
<p>- 当您尝试创建一个两列浮动的布局， IE浏览器将创建一个“浮动下降” ，这是由于在一个固定宽度的浮动DIV内存在超出宽度的内容，这些内容必须融入布局中的一个特定位置。这片文章详述了几种可能的替代方法。</p>
<p><a rel="external nofollow" href="http://www.positioniseverything.net/explorer/expandingboxbug.html"><img src="http://slj.me/wp-content/uploads/2010/04/184447t9q.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>CSS 定位</h3>
<h3>9-?<a rel="external nofollow" href="http://kilianvalkhof.com/2008/css-xhtml/understanding-css-positioning-part-1">理解CSS定位Part 1</a></h3>
<p>-一系列很有趣的文章，这些文章不仅包括定位，还包括包括定义布局的属性，比如display和float ，和对CSS3 布局模型的一个预览。第一部分将会介绍定位和display属性。<a rel="external nofollow" href="http://kilianvalkhof.com/2008/css-xhtml/understanding-css-positioning-part-1/">Part1</a>,?<a rel="external nofollow" href="http://kilianvalkhof.com/2008/css-xhtml/understanding-css-positioning-part-2/">Part2</a>,?<a rel="external nofollow" href="http://kilianvalkhof.com/2008/css-xhtml/understanding-css-positioning-part-3/">Part3</a> 将会带给你对定位的更深的理解.</p>
<p><a rel="external nofollow" href="http://kilianvalkhof.com/2008/css-xhtml/understanding-css-positioning-part-1"><img src="http://slj.me/wp-content/uploads/2010/04/184448aca.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>10-?<a rel="external nofollow" href="http://www.detacheddesigns.com/blog/blogSpecific.aspx?BlogId=52">relative和absolute有什么不同?</a></h3>
<p>- 对于刚开始使用CSS的人来说，无论相对行为还是绝对定位都是非常令人沮丧的。这个问题的答案将会让你的迷惑变的清晰些。</p>
<pre><code>#redSquare
{
position: relative;
bottom: 40px;
right: 40px;
}
</code></pre>
<p>显示这样:</p>
<p><a rel="external nofollow" href="http://www.detacheddesigns.com/blog/blogSpecific.aspx?BlogId=52"><img src="http://slj.me/wp-content/uploads/2010/04/184449ne4.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>11-<a rel="external nofollow" href="http://css-tricks.com/hangtab-create-a-sticky-tag-from-the-edge-of-the-browser-window-even-with-centered-content/">HangTab(固定标签)</a></h3>
<p>- 在浏览器边缘创建一个固定的标签(即使内容居中)。查看<a rel="external nofollow" href="http://www.panic.com/coda/">Panic’s website for their software Coda</a>.</p>
<pre><code>#hang_tab {
position: absolute;
top: 7px;
left: 0px;
width: 157px;
height: 93px;
}</code></pre>
<p><a rel="external nofollow" href="http://css-tricks.com/examples/HangTab/"><img src="http://slj.me/wp-content/uploads/2010/04/1844492oj.jpg" alt="CSS Tips" /></a></p>
<hr />
<h3>CSS 浮动概念</h3>
<h3>12-?<a rel="external nofollow" href="http://www.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/">CSS 浮动原理：你应该知道的事情</a></h3>
<p>-?<a rel="external nofollow" href="http://www.smashingmagazine.com/">SmashingMagazine</a> 浏览几十个相关文章，并选择了在用float开发基于CSS的布局时你应该牢记的最重要的东西。</p>
<pre><code>&lt;div&gt; &lt;!-- float container --&gt;
&lt;div style="float:left; width:30%;"&gt;&lt;p&gt;Some content&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Text not inside the float&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<hr />
<h3>13-?<a rel="external nofollow" href="http://css.maxdesign.com.au/floatutorial/">Floatutorial: CSS float的简单教程</a></h3>
<p>- Floatutorial带你查看浮动元素的基本原理，例如图片，下拉菜单，下一个和返回按钮，相册，内部列表和多列布局。</p>
<p><a rel="external nofollow" href="http://css.maxdesign.com.au/floatutorial/"><img src="http://slj.me/wp-content/uploads/2010/04/18445099l.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>14-?<a rel="external nofollow" href="http://dtott.com/thoughts/2007/12/10/clear-your-floats-the-right-way/">清除浮动- 正确的方法</a></h3>
<p>- 清除浮动可以说是CSS开发中的一个最令人沮丧的方面，最佳方法之一是在您的网站上使用<a rel="external nofollow" href="http://dtott.com/thoughts/2007/12/10/clear-your-floats-the-right-way/">EasyClearing</a> .</p>
<pre><code>/* EasyClearing http://www.positioniseverything.net/easyclearing.html */
#container:after
{
	content: ".";
	display: block;
	height: 0;
	clear: both;
	visibility: hidden;
}

#container
{display: inline-block;}

/* Hides from IE-mac \*/
* html #container
{height: 1%;}

#container
{display: block;}
/* End hide from IE-mac */</code></pre>
<p><a rel="external nofollow" href="http://dtott.com/thoughts/2007/12/10/clear-your-floats-the-right-way/"><img src="http://slj.me/wp-content/uploads/2010/04/1844518xr.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>更简单的圆角实现</h3>
<h3>15-?<a rel="external nofollow" href="http://www.askthecssguy.com/2007/11/mike_asks_the_css_guy_for_reco_1.html">迈克询问CSS圆角建议</a></h3>
<p>- “最简单的方法是使用一个大的gif图片，然后我将给我的盒子编码”</p>
<pre><code>&lt;div&gt;
  &lt;p&gt;beautifully-encapsulated paragraph&lt;/p&gt;
  &lt;div&gt;&lt;/div&gt;
&lt;/div&gt;</code></pre>
<p>“并给它添加背景”</p>
<pre><code>.roundBox {
  background:transparent url(roundBox.gif) no-repeat top left;
  width:340px;
  padding:20px;
}
.roundBox .boxBottom {
  background:white url(roundBox.gif) no-repeat bottom left;
  font-size:1px;
  line-height:1px;
  height:14px;
  margin:0 -20px -20px -20px;
}</code></pre>
<hr />同样?<a rel="external nofollow" href="http://www.askthecssguy.com/">Askthecssguy</a> 介绍了?<a rel="external nofollow" href="http://www.askthecssguy.com/2008/03/one_pixel_notched_corners_as_u.html">Google Analytics中使用的技术</a>, 他是通过在每个角留下1px的边框来实现圆角的效果，这是一种不用静态图片实现圆角的新方法。你可以在<a rel="external nofollow" href="http://www.askthecssguy.com/examples/notchedcorners/index.html">这里</a>查看一个示例.</p>
<p><a rel="external nofollow" href="http://www.askthecssguy.com/2008/03/one_pixel_notched_corners_as_u.html"><img src="http://slj.me/wp-content/uploads/2010/04/184452152.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>16-<a rel="external nofollow" href="http://cssglobe.com/post/1415/3-simple-steps-in-coding-a-rounded-corners-layout">3 个简单的步骤实现圆角</a></h3>
<p>- Alen Grakalic研究了通过三个步骤来编写一个固定宽度的圆角布局. 他也创建了一个<a rel="external nofollow" href="http://cssglobe.com/articles/3steps/">demo </a>.</p>
<p><a rel="external nofollow" href="http://cssglobe.com/articles/3steps/"><img src="http://slj.me/wp-content/uploads/2010/04/184452fum.jpg" alt="CSS Tips" /></a></p>
<hr />
<h3>CSS表单问题</h3>
<h3>17-?<a rel="external nofollow" href="http://css-tricks.com/tips-for-creating-great-web-forms/">创建伟大的网页表单的技巧</a></h3>
<p>- Cris Coyer和我们分享了浮动标签，:focus伪类，使用建议等技巧。他同样建立了<a rel="external nofollow" href="http://css-tricks.com/examples/NiceSimpleContactForm/">又好又简单的联系表单</a>, 他首先将它发布在<a rel="external nofollow" href="http://css-tricks.com/nice-and-simple-contact-form/">这里</a>.</p>
<pre><code>label {
	float: left;
	text-align: right;
	margin-right: 15px;
	width: 100px;
}</code></pre>
<hr /><a rel="external nofollow" href="http://css-tricks.com/examples/NiceSimpleContactForm/"><img src="http://slj.me/wp-content/uploads/2010/04/184453mi3.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>18-?<a rel="external nofollow" href="http://woork.blogspot.com/2008/06/clean-and-pure-css-form-design.html">简洁而纯粹的CSS表单设计</a></h3>
<p>- 对于的CSS爱好者来说，本教程表述了一个如何设计纯粹的CSS表单而不使用HTML表格的建议。你可以在<a rel="external nofollow" href="http://www.box.net/shared/1zbtouuwws">这里</a>抓取代码.</p>
<p><a rel="external nofollow" href="http://woork.blogspot.com/2008/06/clean-and-pure-css-form-design.html"><img src="http://slj.me/wp-content/uploads/2010/04/184454ybj.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>19-<a rel="external nofollow" href="http://www.456bereastreet.com/archive/200710/autopopulating_text_input_fields_with_javascript/">用javascript自动填充文本输入框</a></h3>
<p>- 有时候，我们需要向用户解释他们理应填写文本输入框。当没有标签可以显示，一个通用的解决方案是，把一些占位符文本放在文本框中，并让它当标签来用。本教程介绍了一种很好的解决办法，并启用JavaScript ，label 元素是隐藏的，而且input 元素的title 属性值被复制到value 属性. 如果已禁用JavaScript ，标签显示在被留空的文字输入框的上面。一个简单的演示，您可以在<a rel="external nofollow" href="http://www.456bereastreet.com/lab/autopopulating-text-input-fields/">这里</a>看到演示.</p>
<p><a rel="external nofollow" href="http://www.456bereastreet.com/lab/autopopulating-text-input-fields/"><img src="http://slj.me/wp-content/uploads/2010/04/184455ejp.gif" alt="CSS Tips" /></a></p>
<hr />
<h3>值得检验的css技巧</h3>
<h3>20-<a rel="external nofollow" href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&amp;postId=4361&amp;productId=1&amp;loc=en_US"> 跨浏览器的用背景图的水平线</a></h3>
<p>- 你或许想使用一个定制的图片来创建一个跨浏览器的水平线作为内容的分隔。</p>
<pre><code>div.hr {
background: #fff url(myhrimg.gif) no-repeat scroll center;
height: 10px
}
div.hr hr {
display: none
}</code></pre>
<hr />你的代码可以像这样:</p>
<pre><code>&lt;div&gt;&lt;hr /&gt;&lt;/div&gt;

本文翻译自：<a rel="external nofollow" href="http://www.noupe.com/css/using-css-to-fix-anything-20-common-bugs-and-fixes.html" target="_blank">http://www.noupe.com/css/using-css-to-fix-anything-20-common-bugs-and-fixes.html</a>
转载请注明来源，谢谢</code></pre>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2009/06/10-astonishing-css-hacks-and-techniques/" title="【译】10个惊人的CSS hack和技术 (10 astonishing CSS hacks and techniques)">【译】10个惊人的CSS hack和技术 (10 astonishing CSS hacks and techniques)</a></li><li><a href="http://slj.me/2009/03/browser_css_hack_ie_ff/" title="关于一些浏览器的的Hack">关于一些浏览器的的Hack</a></li><li><a href="http://slj.me/2010/07/css-rgba/" title="CSS中的RGBa色彩">CSS中的RGBa色彩</a></li><li><a href="http://slj.me/2010/05/html5-new-features/" title="HTML5新功能演示">HTML5新功能演示</a></li><li><a href="http://slj.me/2010/03/ultimate-guide-css-text-typography/" title="[转]CSS文字排版终极指南">[转]CSS文字排版终极指南</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/04/%e7%94%a8css%e4%bf%ae%e6%ad%a3%e4%b8%80%e5%88%87%ef%bc%9a20%e5%a4%9a%e4%b8%aa%e5%b8%b8%e8%a7%81bug%e5%8f%8a%e5%85%b6%e4%bf%ae%e6%ad%a3%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>15个Google为网站开发者打造的工具</title>
		<link>http://slj.me/2010/04/15%e4%b8%aagoogle%e4%b8%ba%e7%bd%91%e7%ab%99%e5%bc%80%e5%8f%91%e8%80%85%e6%89%93%e9%80%a0%e7%9a%84%e5%b7%a5%e5%85%b7/</link>
		<comments>http://slj.me/2010/04/15%e4%b8%aagoogle%e4%b8%ba%e7%bd%91%e7%ab%99%e5%bc%80%e5%8f%91%e8%80%85%e6%89%93%e9%80%a0%e7%9a%84%e5%b7%a5%e5%85%b7/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 15:09:13 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1691</guid>
		<description><![CDATA[Google 的使命是 Web，在 Google 眼中，未来的一切应用都将 Web 化，一直以来，Google 为 Web 开发与设计者推出了大量免费工具，让他们更好地创建，维护，改善他们的 Web 站点，这些工具包含了开发，分析，维护，修补等等用途，本文将介绍15款这样的工具。 1. Google Chrome Developer Tools 这是 Google Chrome 中类似 Firefox Firebug 以及 Web Developer Toolbar 的一个扩展，用于调试你的网页，包含一个 DOM 探测器，一个 JavaScript 调试台，可以设置执行断点和跟踪，一个类似 YSlow 的执行分析器。 2. Webmaster Tools 一个对网站拥有者来说非常有用的程序，可以帮助你从各个角度改善自己的站点。可以发现站点中的恶意程序，发现搜索引擎爬虫遇到的错误，可以发现你的 HTML 代码中需要改进的部分。还可以帮你发现你的站点中最热门的网页，并发现你站点中的错误链接。 3. Google Web Toolkit Google Web Tootlkit （GWT）是一个 Web 开发基础框架，为开发者提供了一些基础类库，GWT 同 Google 的其它产品，如 AdWords，FeedBurner，Google Ajax [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://slj.me/wp-content/uploads/2010/04/15_google_tools_post_thumb2.png" alt="15个Google为网站开发者打造的工具" class="thumb"/></p>
<p>Google 的使命是 Web，在 Google 眼中，未来的一切应用都将 Web 化，一直以来，Google 为 Web 开发与设计者推出了大量免费工具，让他们更好地创建，维护，改善他们的 Web 站点，这些工具包含了开发，分析，维护，修补等等用途，本文将介绍15款这样的工具。</p>
<p><span id="more-1691"></span><br />
1. <a rel="external nofollow" href="http://blog.chromium.org/2009/06/developer-tools-for-google-chrome.html">Google Chrome Developer Tools</a><br />
<a rel="external nofollow" href="http://blog.chromium.org/2009/06/developer-tools-for-google-chrome.html"><img src="http://images.sixrevisions.com/2010/04/17-03_developer_tools.png" alt="" /></a></p>
<p><!--more-->这是 Google Chrome 中类似 Firefox Firebug 以及 <a rel="external nofollow" href="http://sixrevisions.com/tools/firefox_web_developer_extension_toolbar/">Web Developer Toolbar</a> 的一个扩展，用于调试你的网页，包含一个 DOM 探测器，一个 JavaScript 调试台，可以设置执行断点和跟踪，一个类似 YSlow 的执行分析器。<br />
2. <a rel="external nofollow" href="https://www.google.com/webmasters/tools/home?hl=en">Webmaster Tools</a><br />
<a rel="external nofollow" href="https://www.google.com/webmasters/tools/home?hl=en"><img src="http://images.sixrevisions.com/2010/04/17-04_webmaster_tools.png" alt="" /></a></p>
<p>一个对网站拥有者来说非常有用的程序，可以帮助你从各个角度改善自己的站点。可以发现站点中的恶意程序，发现搜索引擎爬虫遇到的错误，可以发现你的 HTML 代码中需要改进的部分。还可以帮你发现你的站点中最热门的网页，并发现你站点中的错误链接。<br />
3. <a rel="external nofollow" href="http://code.google.com/webtoolkit/">Google Web Toolkit</a><br />
<a rel="external nofollow" href="http://code.google.com/webtoolkit/"><img src="http://images.sixrevisions.com/2010/04/17-05_gwt.png" alt="" /></a></p>
<p>Google Web Tootlkit （GWT）是一个 Web 开发基础框架，为开发者提供了一些基础类库，GWT 同 Google 的其它产品，如 AdWords，FeedBurner，Google Ajax 类库等紧密集成，<a rel="external nofollow" href="http://code.google.com/webtoolkit/doc/latest/tutorial/">这里有一个 Google Docs 教程</a>。<br />
4. <a rel="external nofollow" href="http://www.google.com/codesearch">Google Code Search</a><br />
<a rel="external nofollow" href="http://www.google.com/codesearch"><img src="http://images.sixrevisions.com/2010/04/17-06_code_search.png" alt="" /></a></p>
<p>帮助开发者搜索代码，支持正则表达式搜索，或在一个<a rel="external nofollow" href="http://www.google.com/codesearch/advanced_code_search">高级搜索界面</a>中，很直观地搜索那些可能会让你事半功倍的公共代码。<br />
5. <a rel="external nofollow" href="http://code.google.com/speed/page-speed/">Page Speed</a><br />
<a rel="external nofollow" href="http://code.google.com/speed/page-speed/"><img src="http://images.sixrevisions.com/2010/04/17-07_page_speed.png" alt="" /></a></p>
<p>Google 现在已经<a rel="external nofollow" href="http://www.mattcutts.com/blog/site-speed/">将网站加载速度算到搜索排名算法</a>中，<em>Page Speed</em> 可以帮助你分析你的网站性能，基于<a rel="external nofollow" href="http://code.google.com/speed/page-speed/docs/rules_intro.html"> Google Web 性能最佳实践</a>。<br />
6. <a rel="external nofollow" href="http://browsersize.googlelabs.com/">Browser Size</a><br />
<a rel="external nofollow" href="http://browsersize.googlelabs.com/"><img src="http://images.sixrevisions.com/2010/04/17-08_browser_size.png" alt="" /></a></p>
<p>该工具帮你分析，你的网页在不同浏览器，不同浏览尺寸下的显示状况，非常适合看看自己的网页在不滚动的情况下，在各种浏览尺寸下显示到哪里。<br />
7. <a rel="external nofollow" href="http://code.google.com/apis/ajaxlibs/">Google Ajax Libraries API</a><br />
<a rel="external nofollow" href="http://code.google.com/apis/ajaxlibs/"><img src="http://images.sixrevisions.com/2010/04/17-09_ajax_libraries.png" alt="" /></a></p>
<p><em>Google Ajax Libraries API</em> 包含多种流行的 JavaScript 库（目前有10种），并可以从 Google 高性能的 CDN 网络中加载，既节省了你的服务器带宽，同时，由于用户可能已经在别的网站加载过这个库，因此可以显著加快这些库的加载速度。<br />
8. <a rel="external nofollow" href="http://www.google.com/websiteoptimizer/b/index.html">Google Website Optimizer</a><br />
<a rel="external nofollow" href="http://www.google.com/websiteoptimizer/b/index.html"><img src="http://images.sixrevisions.com/2010/04/17-02_website_optimizer.jpg" alt="" /></a></p>
<p>接着这个工具，你可以对自己的网站进行<a rel="external nofollow" href="http://sixrevisions.com/user-interface/an-introduction-to-website-split-testing/"> A/B 测试</a>，并对网站进行优化。<br />
9. <a rel="external nofollow" href="http://sites.google.com/">Sites</a><br />
<a rel="external nofollow" href="http://sites.google.com/"><img src="http://images.sixrevisions.com/2010/04/17-10_google_sites.png" alt="" /></a></p>
<p>顾名思义，Google Sites 可以帮你创建一个托管的网站，可以将包括 YouTube，幻灯，Gmail 日历，Google Gear 小程序，Google Docs 一类的应用集成其中。如果将站点设置为不公开，你可以将这个工具用于个人文档工具。<br />
10. <a rel="external nofollow" href="http://code.google.com/webtoolkit/speedtracer/">Speed Tracer</a><br />
<a rel="external nofollow" href="http://code.google.com/webtoolkit/speedtracer/"><img src="http://images.sixrevisions.com/2010/04/17-12_speed_tracer.jpg" alt="" /></a></p>
<p>以可视化方式，帮你分析你的 Web 程序中各种元素的加载或运行速度与实践，<a rel="external nofollow" href="http://code.google.com/webtoolkit/speedtracer/speed-tracer-examples.html">这里有一些关于这个工具的用例</a>。<br />
11. <a rel="external nofollow" href="http://code.google.com/hosting/">Project Hosting</a><br />
<a rel="external nofollow" href="http://code.google.com/hosting/"><img src="http://images.sixrevisions.com/2010/04/17-13_project_hosting.png" alt="" /></a></p>
<p>这是 Google Code 项目的一部分，可以帮你<a rel="external nofollow" href="http://sixrevisions.com/resources/15-fantastic-finds-on-the-google-code-repository/">托管你的开源项目</a>，Web 开发与设计者还可以在这里找到大量现成的项目以供借鉴或套用。<br />
12. <a rel="external nofollow" href="http://code.google.com/appengine/">Google App Engine</a><br />
<a rel="external nofollow" href="http://code.google.com/appengine/"><img src="http://images.sixrevisions.com/2010/04/17-11_app_engine.png" alt="" /></a></p>
<p>这是一个可用来托管自己的 Web 程序的地方，甚至可以使用自己的域名。这里有一个教程，讲解如何<a rel="external nofollow" href="http://code.google.com/appengine/docs/python/gettingstarted/">使用 Google App Engine 来创建一个留言本</a>。Google App Engine 中已经<a rel="external nofollow" href="http://appgallery.appspot.com/">托管了大量的 Web 程序</a>。<br />
13. <a rel="external nofollow" href="http://code.google.com/apis/charttools/">Google Chart Tools</a><br />
<a rel="external nofollow" href="http://code.google.com/apis/charttools/"><img src="http://images.sixrevisions.com/2010/04/17-14_chart_tools.png" alt="" /></a></p>
<p><em>Google Chart Tools</em> 可以帮助你将数据转化为图表，并嵌入自己的网页，这些图表还拥有交互功能，可以钻入，或通过鼠标盘旋获取详细信息，还可以实现动画图表。<br />
14. <a rel="external nofollow" href="http://code.google.com/closure/">Closure Tools</a><br />
<a rel="external nofollow" href="http://code.google.com/closure/"><img src="http://images.sixrevisions.com/2010/04/17-15_closure_compiler.png" alt="" /></a></p>
<p><em>Closure Tools</em> 是 Google Labs 的一个开发套件，包含3个工具，闭包编译器（一个 JavaScript 优化器），闭包函数库（用于 Ajax 程序开发）以及一个用于动态生成 HTML 的闭包模板。<br />
15. <a rel="external nofollow" href="http://www.google.com/analytics/">Google Analytics</a><br />
<a rel="external nofollow" href="http://www.google.com/analytics/"><img src="http://images.sixrevisions.com/2010/04/17-16_google_analytics.png" alt="" /></a></p>
<p>经典的 Google 流量分析统计工具。</p>
<p>来源：Six Revisions - <a rel="external nofollow" href="http://sixrevisions.com/tools/the-top-15-google-products-for-people-who-build-websites/">The Top 15 Google Products for People Who Build Websites</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2009/10/method-to-uncover-google-gmail-google-reader-for-iphone/" title="揭开iPhone版Google，Gmail，Google Reader神秘面纱的方法">揭开iPhone版Google，Gmail，Google Reader神秘面纱的方法</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/04/15%e4%b8%aagoogle%e4%b8%ba%e7%bd%91%e7%ab%99%e5%bc%80%e5%8f%91%e8%80%85%e6%89%93%e9%80%a0%e7%9a%84%e5%b7%a5%e5%85%b7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>转：使用 Dojo 开发离线应用</title>
		<link>http://slj.me/2010/04/%e8%bd%ac%ef%bc%9a%e4%bd%bf%e7%94%a8-dojo-%e5%bc%80%e5%8f%91%e7%a6%bb%e7%ba%bf%e5%ba%94%e7%94%a8/</link>
		<comments>http://slj.me/2010/04/%e8%bd%ac%ef%bc%9a%e4%bd%bf%e7%94%a8-dojo-%e5%bc%80%e5%8f%91%e7%a6%bb%e7%ba%bf%e5%ba%94%e7%94%a8/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 14:11:44 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1679</guid>
		<description><![CDATA[Dojo 离线功能简介 所谓离线，指的是用户能够在没有网络的环境下也可以进行工作，并且当网络环境恢复后，之前的操作能够自动地同步到服务器上。目前，离线应用可以分为两种，一种是桌面应用，其中以 IBM Lotus Notes 为代表。另外一种则是近来比较热门的 Web 离线应用，其中最具代表的为 Google 的离线应用，如 Google Docs, Gmail, Google Reader 等。而本文介绍的 Dojo 离线功能，则是目前最为流行的实现第二种离线应用的框架。 回页首 Dojo 离线原理 Dojo Offline 是一个免费的开放源代码的离线开发工具，它可以轻松地让 Web 开发人员开发离线应用。Dojo Offline 构建于 Google Gear 之上，它使得在 Google Gear 上开发离线应用变得更加简单。Dojo Offline 对 Google Gears 的 API 进行了封装，能够更方便地以 JavaScript 的方式访问数据；另外，Dojo Offline 还提供了如下功能： Offline Widget：开发人员只要添加几行代码，就能够将这个离线的 widget 嵌入自己的应用中，之后，就能够自动获得网络反馈 , 同步消息以及离线操作配置说明等。 同步框架：保存离线数据，并且在网络恢复后将这些操作和服务器进行同步。 自动的网络和应用程序状态监控机制：离线应用可以基于这些监控结果来决定采取什么样的操作。 slurp() [...]]]></description>
			<content:encoded><![CDATA[<p><a name="1.Dojo 离线功能简介 |outline">Dojo 离线功能简介</a></p>
<p>所谓离线，指的是用户能够在没有网络的环境下也可以进行工作，并且当网络环境恢复后，之前的操作能够自动地同步到服务器上。目前，离线应用可以分为两种，一种是桌面应用，其中以 IBM Lotus Notes 为代表。另外一种则是近来比较热门的 Web 离线应用，其中最具代表的为 Google 的离线应用，如 Google Docs, Gmail, Google Reader 等。而本文介绍的 Dojo 离线功能，则是目前最为流行的实现第二种离线应用的框架。</p>
<p><span id="more-1679"></span></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /><br />
<img src="http://www.ibm.com/i/c.gif" border="0" alt="" width="8" height="6" /></td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" align="right">
<tbody>
<tr align="right">
<td><img src="http://www.ibm.com/i/c.gif" alt="" width="100%" height="4" /></p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" border="0" alt="" width="16" height="16" /></td>
<td align="right" valign="top"><a href="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/#main"><strong>回页首</strong></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p><a name="2.Dojo 离线原理 |outline">Dojo 离线原理</a></p>
<p>Dojo Offline 是一个免费的开放源代码的离线开发工具，它可以轻松地让 Web 开发人员开发离线应用。Dojo Offline 构建于 Google Gear 之上，它使得在 Google Gear 上开发离线应用变得更加简单。Dojo Offline 对 Google Gears 的 API 进行了封装，能够更方便地以 JavaScript 的方式访问数据；另外，Dojo Offline 还提供了如下功能：</p>
<ol>
<li>Offline Widget：开发人员只要添加几行代码，就能够将这个离线的 widget 嵌入自己的应用中，之后，就能够自动获得网络反馈 , 同步消息以及离线操作配置说明等。</li>
<li>同步框架：保存离线数据，并且在网络恢复后将这些操作和服务器进行同步。</li>
<li>自动的网络和应用程序状态监控机制：离线应用可以基于这些监控结果来决定采取什么样的操作。</li>
<li>slurp() 方法：通过 slurp() 方法来自动扫描页面，找出需要缓存到本地的资源，包括图片，样式，脚本等。这使得 Web 开发人员能够集中精力地去开发业务逻辑和展示页面，而不需要考虑具体哪些资源需要缓存到本地。</li>
<li>提供两种本地存储实现方法：Dojo Storage 和 Dojo SQL。Dojo Storage 使用哈希表来存储离线数据，为开发人员屏蔽了重量级的 Google Gears 的 SQL 使用方法，我们可以通过 Dojo Storage 将数据保存到 Google Gears 里去。Dojo SQL 通过执行 SQL 命令，对一般的 JavaScript 对象进行存取。</li>
<li>加密和解密关键字 ENCRYPT() 和 DECRYPT()：提供对下载后的离线数据加密和解密方法。</li>
<li>Dojo 其他模块的集成：如果用户选择 Dojo Offline，毫无疑问，其应用可以受益于 Dojo 的其他功能，比如完善的事件处理机制，Ajax 框架等等。</li>
</ol>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /><br />
<img src="http://www.ibm.com/i/c.gif" border="0" alt="" width="8" height="6" /></td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" align="right">
<tbody>
<tr align="right">
<td><img src="http://www.ibm.com/i/c.gif" alt="" width="100%" height="4" /></p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" border="0" alt="" width="16" height="16" /></td>
<td align="right" valign="top"><a href="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/#main"><strong>回页首</strong></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p><a name="3.Google Gears 简介 |outline">Google Gears 简介</a></p>
<p>Google Gears 是 Google 开发的一个自由和开源软件，以 BSD 许可证发布。主要是为了能够让用户可以在离线时能够继续使用 Web 应用。这套软件透过 SQLite 数据库让本地端能够把资料暂存起来。所以网页是透过缓存取得的，而不是从实际的网络上取得。而且，Web 相关的程序可以周期性的透过 Gears 将本地缓存的资料与网络上的资料做同步。如果网络暂时无法使用，这个同步过程将会延后，直到网络恢复为止。Google Gears 通过以浏览器扩展的方式添加 JavaScript API，使得浏览器的脚本能够访问本地的缓存数据库。该扩展目前支持 Firefox，Internet Explorer 和 Safari，并需工作于 Windows、Mac OS X，或是 Linux 下。</p>
<p>Google Gears 有几个主要的组件：</p>
<ol>
<li>一个本地服务器，用来存储和读取离线程序资源（包括 HTML 文件 , JavaScript 文件 , 图片等）。</li>
<li>一个小型数据库（基于 SQLite 轻量数据库），用来储存本地数据。</li>
<li>一个工作池，用来让开发者将本地数据与服务器端后台同步。</li>
<li>一个桌面模型，可使网络程序的操作贴近桌面程序。</li>
<li>一个地理定位模型，能够让网络程序侦测到目前用户的地理位置。</li>
</ol>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /><br />
<img src="http://www.ibm.com/i/c.gif" border="0" alt="" width="8" height="6" /></td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" align="right">
<tbody>
<tr align="right">
<td><img src="http://www.ibm.com/i/c.gif" alt="" width="100%" height="4" /></p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" border="0" alt="" width="16" height="16" /></td>
<td align="right" valign="top"><a href="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/#main"><strong>回页首</strong></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p><a name="4. 开发 Dojo 离线应用程序 |outline">开发 Dojo 离线应用程序</a></p>
<p>一般来说开发一个离线应用有以下几个步骤：</p>
<ol>
<li>应用加载时缓存所引用的资源。</li>
<li>应用加载之后设置必要的离线事件处理函数。如：与服务器进行同步操作时的下载事件、下载完成事件，重放事件等。</li>
<li>检查应用是否在线，读取应用所需的数据。如果离线则从本地读取数据；如果在线则与服务器数据进行同步：首先上传离线数据（如果有的话），然后从服务器上下载最新数据。</li>
<li>初始化应用程序。</li>
</ol>
<p>下面我们会先分别介绍如何保存离线资源，保存和使用应用离线数据以及如何与服务器的数据保持同步等相关技术，然后以一个具体的例子说明如何按上述步骤开发一个离线应用。</p>
<p><a name="N10125">保存离线资源</a></p>
<p>为了使页面能够在离线情况下操作，在页面加载时必须要保存页面所引用的 HTML 文件，JavaScript 文件，CSS 文件，图片文件等资源，这样在与服务器断开连接时，页面便能够从本地缓存中提取到页面及相关的资源。Dojo 提供了一个功能非常强大的函数 slurp 来实现这一功能。slurp 函数在页面加载之后会自动分析页面所引用的资源，并得到一个资源文件的 url 列表，然后抓取 url 的内容，保存到 Google Gears 中。slurp 函数能够缓存大部分的资源文件，包括引用 CSS 文件里的图片，但是对于使用内联方式指定的 CSS 图片以及用 JavaScript 动态产生的引用 slurp 则无法进行缓存。这种情况可以通过调用 dojox.off.files.cache () 方法来手动添加要缓存的资源，具体用法详见后文。</p>
<p>Dojo Offline 还提供了在调试时查看已缓存资源文件的方法，首先以 debug 方式加载 Dojo，然后在页面和 Dojo Offline 加载完之后调用 dojox.off.files.printURLs() 函数。这个函数会在控制台以调试的方式打印出已缓存的资源文件的 url。</p>
<p><a name="N10131">保存和使用离线数据</a></p>
<p>一般来说，离线应用不仅要缓存页面所引用的 HTML 文件，JavaScript，CSS，图片等资源，还要缓存页面所使用的数据。Dojo 对 Google Gears 的访问接口进行了封装，提供了 Dojo Storage 和 Dojo SQL 两种方式操作离线数据。通过这两种方式，用户可以方便、灵活地保存和读取离线数据。</p>
<ul>
<li>Dojo Storage</li>
</ul>
<p>提供了一种类似哈希表的方式对数据进行操作，数据以键值对的方式存取。</p>
<p>保存：dojox.storage.put(key,value) — key 是字符串类型，value 可以是字符串和可序列化的 JavaScript 对象，但是浏览器对象（如 DOM 节点和 XMLHttpRequest 对象）是不能够保存的。</p>
<p>读取：var value = dojox.storage.get(key) —获取字符串 key 对应的值。<br />
<a name="N1014A"><strong>清单 1</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>var car = {type: "Nissan", color: "white", price: 20000, optional:
 "air-conditioner, stereo"};
dojox.storage.put("complexKey", car);

var value = dojox.storage.get("someKey");
var car = dojox.storage.get("complexKey");
if(car)
alert(car.type);</pre>
</td>
</tr>
</tbody>
</table>
<p>上述代码先将一个对象 car 放置在 Dojox.Storage 里，然后又从中取出并展示。</p>
<ul>
<li>Dojo SQL</li>
</ul>
<p>通过 Dojo SQL 对 Google Gears 关系存储层的封装，能够以更适合 JavaScript 对象的访问方式对关系表进行操作。如下所示，我们对 Documents 表进行了创建，插入，查询操作：<br />
<a name="N1015D"><strong>清单 2</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>//create Documents table if not exist
dojox.sql("CREATE TABLE IF NOT EXISTS DOCUMENTS ("
+ "fileName		TEXT NOT NULL PRIMARY KEY UNIQUE,"
+ "content		TEXT NOT NULL) ");
//insert a record
dojox.sql("INSERT INTO DOCUMENTS (fileName, content) VALUES (?, ?)", fileName, contents);
//query
var results = dojox.sql("SELECT * FROM DOCUMENTS WHERE fileName = ?", someFileName);</pre>
</td>
</tr>
</tbody>
</table>
<p>Dojo 查询操作返回的是一个记录对象的数组，如访问第一条记录的 fileName 字段，可以使用 results[0].fileName，访问 content 字段则可以使用 results[0].content。</p>
<p><a name="N10166">与服务器同步数据</a></p>
<p>离线操作所产生的新数据，在与服务器连接可用时需要上传到服务器；并且，在该用户离线期间，其他用户也可能已经更改过数据，因此重新连接服务器时需要下载最新的数据。Dojo 的同步操作发生的时机有两个，一是在页面首次加载并且在线的时候，或是离线后又检测到连接恢复的时候，具体包括 3 个步骤：</p>
<ol>
<li>下载并缓存最新的页面资源，包括由 slurp 函数以及用户手动缓存的资源。Dojo Offline Widget 会自动更新相应的状态，如下图所示：
<p><a name="N10174"><strong>图 1. 下载状态 </strong></a><br />
<img src="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/image003.jpg" alt="下载状态" width="164" height="140" /></li>
<li>上传用户在离线期间所创建的数据。
<p><a name="N10185"><strong>图 2. 上传状态 </strong></a><br />
<img src="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/image005.jpg" alt="上传状态" width="166" height="142" /></li>
<li>下载服务器最新数据进行展示。
<p><a name="N10196"><strong>图 3. 同步成功 </strong></a><br />
<img src="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/image007.jpg" alt="同步成功" width="166" height="140" /></p>
<p>如上所示，Dojo Offline 提供了一个 UI 控件来通知用户当前的状态，如下载，上传以及网络连接状态等。Dojo Offline Widget 处理了大部分的逻辑，开发人员可以直接在页面中使用该控件。使用 Offline Widget 很简单，只需在页面加入一个占位符即可。Offline Widget 也提供了扩展机制，以更改所使用的图片和样式来跟页面风格保持一致。</li>
</ol>
<p><a name="N101A7">Dojo 离线应用示例</a></p>
<p>Dojo Offline 随附的开发包中提供了 3 个例子，下面以 hello world 为例说明如何构建一个简单的离线应用。hello world 程序模拟了用户与服务器简单的消息交互。用户界面包括一个输入框和一个发送按钮，在输入框里输入文本，点击发送按钮将消息发送到服务器。为了保持用例的简单，实际上消息并没有真正被发送到服务器，而只是简单地将其弹出。在应用离线时，点击发送按钮则会先在本地保存该消息，当应用重新连接时再重新执行该操作。</p>
<ol>
<li>首先加载 Dojo 及离线所使用的 JavaScript 文件。
<p><a name="N101B5"><strong>清单 3</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>&lt;script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="../../../../dojox/off/offline.js"&gt;
&lt;/script&gt;</pre>
</td>
</tr>
</tbody>
</table>
<p>当然，我们也可以用 dojo.require 方法进行加载：</p>
<p><a name="N101C0"><strong>清单 4</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>&lt;script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"&gt;&lt;/script&gt;
&lt;script type="text/javascript" &gt;
 dojo.require(“dojox.off.offline”);
 &lt;/script&gt;</pre>
</td>
</tr>
</tbody>
</table>
</li>
<li>设置应用程序的名字，这个名字会显示在 Dojo Offline Widget 上。
<p><a name="N101CB"><strong>清单 5</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>dojox.off.ui.appName = "Hello World";</pre>
</td>
</tr>
</tbody>
</table>
</li>
<li>缓存页面资源文件。要使离线功能正常工作，这个函数必须在 Dojo Offline 初始化之前调用，即 dojox.off.initialize 函数调用之前。
<p><a name="N101D5"><strong>清单 6</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>dojox.off.files.slurp();</pre>
</td>
</tr>
</tbody>
</table>
</li>
<li>初始化应用程序，设置离线操作的一些事件响应函数。
<p><a name="N101DF"><strong>清单 7</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>initialize: function(){
	console.debug("helloWorld.initialize");
	var self = this;
	dojo.connect(dojox.off.sync, "onSync", this, function(type){
		if(type == "download"){
			self._messages.push("Hi! This is fake downloaded data!");
			dojox.storage.put("messages", self._messages);
			dojox.off.sync.finishedDownloading();
		}else if(type == "finished"){
			this._messages = [];
			dojox.storage.remove("messages");
		}
	});
	dojo.connect(dojox.off.sync.actions, "onReplay", this,
				function(action, actionLog){
					if(action.name == "new hello world message"){
						var message = action.data;
						self.sendMessage(message);
						actionLog.continueReplay();
				}
	});
	if(!dojox.off.isOnline){
		this.loadOfflineData();
	}
	this.printMessages();
}</pre>
</td>
</tr>
</tbody>
</table>
<p>可以看到，此处最主要的两个操作是设置 dojox.off.sync 对象的 onSync 事件和 dojox.off.sync.actions 对象的 onReplay 事件。其中，onSync 用来处理与服务器的同步，download 事件发生在第一次加载页面或是网络重新连接的时候，在该事件中我们应该从服务器下载数据，并在下载完毕之后调用 dojox.off.sync.finishedDownloading() 方法，以便告诉 Dojo Offline Widget 更新当前状态。finished 事件则说明从服务器下载数据结束，可以更新应用程序了。</p>
<p>Dojo Offline 使用 action log 来记录用户在离线时所执行的操作，并在重新获得网络连接时再次执行这些操作，将数据上传到服务器。</p>
<p>一般来说，程序初始化时首先要判断应用是否在线，如果不在线则加载本地数据进行页面展示。值得注意的是，这些事件何时触发是由 Dojo Offline 的同步框架根据当前应用程序状态决定的，开发人员只需设置相应的事件处理函数即可。</li>
<li>保存离线数据，这是通过创建 action log 来实现的。在与服务器重新连接时 action log 会自动重新执行。
<p><a name="N101F2"><strong>清单 8</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>saveOfflineSend: function(message){
	this._messages.push(message);
	dojox.storage.put("messages", this._messages);
	var action = {name: "new hello world message", data: message};
	dojox.off.sync.actions.add(action);
	alert("This message has been saved for sending when we go back online");</pre>
</td>
</tr>
</tbody>
</table>
</li>
<li>Dojo 的离线功能要在页面加载完及 Dojo Offline 初始化之后才能工作，因此页面本身的代码要在 Dojo Offline 初始化完成之后执行。Dojo Offline 的初始化完成可以用 dojox.off.ui 的 onLoad 事件来标识。我们首先将页面的初始化函数绑定到 dojox.off.ui 的 onLoad 事件，然后调用 dojox.off.initialize 函数对 Dojo Offline 进行初始化。
<p><a name="N101FD"><strong>清单 9</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>dojo.connect(dojox.off.ui, "onLoad", helloWorld, "initialize");
dojox.off.initialize();</pre>
</td>
</tr>
</tbody>
</table>
</li>
<li>加载 Dojo Offline Widget。实际上任何 html 元素，只要 id 为“dot-widget”都可以作为 Offline Widget 的占位符。Dojo Offline 初始化的时候会对这个元素进行填充。
<p><a name="N10208"><strong>清单 10</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>&lt;div id="dot-widget"&gt;&lt;/div&gt;</pre>
</td>
</tr>
</tbody>
</table>
</li>
<li>为页面加入展示元素。
<p><a name="N10213"><strong>清单 11</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>&lt;div id="helloMessage" style="margin: 1em;"&gt;
&lt;label for="helloInput" 	style="margin-right: 0.2em;"&gt;
Enter Hello World Message:
&lt;/label&gt;
&lt;input name="helloInput" id="helloInput" 	style="margin-right: 0.2em;"&gt;
&lt;button id="sendMessage" onclick="helloWorld.send()" style="margin-right: 0.2em;"&gt;
Send&lt;/button&gt;
&lt;/div&gt;
&lt;p&gt;Debug output:&lt;/p&gt;</pre>
</td>
</tr>
</tbody>
</table>
</li>
<li>运行 hello world
<p>hello world 示例程序不涉及服务器端代码，因此并不一定需要部署才能执行。但是为了便于测试在线 / 离线操作，最好还是通过服务器访问。</p>
<p>在 Dojo Offline 里随附的例子中，Moxie 编辑器是一个包括服务器和客户端的完整应用程序，它使用 Jetty 作为 Web 容器，使用 Derby 作为数据库。我们可以启动 Moxie 应用所在的 Jetty 容器来访问 hello world 应用。</p>
<p>首先请安装 jdk1.5 或以上版本，在 dojox/off/demos/editor/server/ 目录下，运行：</p>
<p>java -jar editor.jar</p>
<p>在浏览器地址栏输入 http://localhost:8000/dojox/off/demos/helloworld/helloworld.html 即可访问 hello world 应用。可以通过关闭 / 打开 Jetty 来观察 hello world 和 Dojo Offline Widget 在离线、在线及同步时的行为。</li>
</ol>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /><br />
<img src="http://www.ibm.com/i/c.gif" border="0" alt="" width="8" height="6" /></td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" align="right">
<tbody>
<tr align="right">
<td><img src="http://www.ibm.com/i/c.gif" alt="" width="100%" height="4" /></p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" border="0" alt="" width="16" height="16" /></td>
<td align="right" valign="top"><a href="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/#main"><strong>回页首</strong></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p><a name="5. 高级议题 |outline">高级议题</a></p>
<p><a name="N10235">网页资源的手工缓存</a></p>
<p>尽管利用 slurp() 方法可以为我们完成很多自动化的工作，但一些出现在 JavaScript 中的动态加载的资源是 slurp() 所无法分析得到的。因此，在实际应用中作为补充，我们往往还需要将一些 slurp 过程中的“漏网之鱼”手工加入本地缓存中。而 Dojo Offline 也为我们提供了相应的功能以支持这一需求。</p>
<p>手工将网络资源加入本地缓存的方法十分简单，例如，假设我们要将一个名为 big_and_little_fish.jpg 的文件缓存起来，可以执行如下方法：<br />
<a name="N10243"><strong>清单 12</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>dojox.off.files.cache("images/big_and_little_fish.jpg");</pre>
</td>
</tr>
</tbody>
</table>
<p>不仅如此，Dojo Offline 还提供了一次性指定多个文件的功能，调用方法如下所示：<br />
<a name="N1024F"><strong>清单 13</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>dojox.off.files.cache([
 "images/fish1.png",
 "images/fish2.png",
 "scripts/some_dynamic_fish.js"
 ]);</pre>
</td>
</tr>
</tbody>
</table>
<p>我们可以多次调用 cache() 方法，假如调用过程中指定了多个同名文件，则最后一次被缓存的文件将会替换前面的同名文件。利用这一方法，再结合前述的 slurp() 方法，我们就可以很好的将离线所需的全部资源在本地缓存起来了。</p>
<p><a name="N10258">数据的加密与解密</a></p>
<p>将数据下载到本地进行缓存是离线功能得以实现的重要步骤，但是假如这些数据中包含有敏感信息，例如身份证号码，而本地环境又不甚安全时，则对数据进行加密处理是很有必要的。前面曾经提到，我们在利用 Dojo Offline 进行数据存储时可以选择使用 Dojo SQL。而 Dojo SQL 允许我们很方便的对数据的某些字段进行加密和解密。</p>
<p>假设我们以前面的 DOCUMENT 表为例，假定其中的“content”字段属于敏感信息。</p>
<p>Dojo SQL 提供了两个特殊的关键字，ENCRYPT() 和 DECRYPT()，分别用以实现加密和解密操作。以 content 为例，调用方式类似如下：<br />
<a name="N10269"><strong>清单 14</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>var password = "password";
dojox.sql("INSERT INTO DOCUMENTS VALUES (?,ENCRYPT(?))", "helloworld.txt",
"sensitive content", password,
function(results, error, errorMsg){
if(error){ alert(errorMsg); return; }
});</pre>
</td>
</tr>
</tbody>
</table>
<p>在上述代码中，我们在后一个字段加上了 ENCRYPT 关键字，声明对其进行加密。除此以外，我们还提供了一个 password 参数，这是底层加密机制所必须的。当我们启用应用系统时，系统会提示输入这一密码。出于对本地数据安全性的考虑，请不要将其存于 Cookie，Dojo Storage，或是 Dojo SQL 中，否则他人就可以轻易利用这一密码解开存于本地的敏感数据。另外，上述代码里还定义了一个回调函数。该回调函数将会在加密过程结束之后被调用。如果加密成功，results 对象中将会包含经过加密后的数据；如果加密失败，则 error 值将会为 true，并且 errorMsg 中会包含对错误原因的描述信息。</p>
<p>和加密一样，对数据进行解密的过程也十分简单。我们只需对需要解密的字段调用 DECRYPT 关键字即可。示例代码如下：<br />
<a name="N10277"><strong>清单 15</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>var password = "password";
dojox.sql("SELECT fileName, DECRYPT(content) FROM DOCUMENTS",
password,
function(results, error, errorMsg){
if(error){ alert(errorMsg); return; }
// go through decrypted results
alert("First document info: "
+ results[0].fileName + " "
+ results[0].content);
});</pre>
</td>
</tr>
</tbody>
</table>
<p>在上述代码中，我们利用 alert 语句将加密后的第一条结果数据打印了出来。其中的 password 必须与加密时所使用的完全一致，否则解密将会失败，结果数据将仍然是加密后的样子。</p>
<p>假如我们要对多个字段进行加密，Dojo SQL 的 ENCRYPT 还有一种很方便的书写方法，即：ENCRYPT(?, ?)；同样的，对于 DECRYPT 也存在类似的书写方式，已完成一次性对多个数据字段进行解密：DECRYPT(fileName, content)</p>
<p><a name="N10283">定制 Offline Widget</a></p>
<p>虽然利用 Dojo Offline Widget 可以省去我们很多的功夫，但是在某些情况下，其默认行为并不一定能够很好的满足我们的需要，例如：默认的样式风格与我们的应用程序不一致，此时，我们就可以对 Offline Widget 进行一定程度的定制。</p>
<p>事实上，我们在页面上所见到的 Offline Widget 有其对应的模板文件，该文件位于 dojox/off/resources/offline-widget.html，其中包含有一系列的 HTML 元素，这些元素都有相应的 ID，比如：dot-widget-network-indicator，Offline Widget 就是利用默认的 CSS 文件对其进行控制的，该 CSS 文件位于：dojox/off/resources/offline-widget.css。我们可以通过自定义 CSS 的方式来改变 HTML 元素的样式，从而改变 Offline Widget 在页面中的展现风格。</p>
<p>除了改变展现风格，有时我们可能还需要改变展现的内容，我们可以将 offline-widget.html 中的内容选择性的复制到我们自己的 HTML 页面中，这样我们就可以根据自己的需要随意设计 Offline Widget 的展现内容，而无需定义一个 ID 为 dot-widget 的特定 DIV 了。</p>
<p>此外，如果我们只是想修改 Offline Widget 所使用的默认图标的话，则还有更为简单的做法。那就是对如下几个 JavaScript 变量进行修改：</p>
<ul>
<li>dojox.off.ui.onlineImagePath：表示在线状态的图标</li>
<li>dojox.off.ui.offlineImagePath：表示离线状态的图标</li>
<li>dojox.off.ui.rollerImagePath：表示同步正在进行的图标</li>
<li>dojox.off.ui.checkmarkImagePath：表示同步结束的图标</li>
</ul>
<p>例如，如果我们想将表示在线状态的绿色小圆球状图标替换为自己设计的图标，则可以修改如下：</p>
<p>dojox.off.ui.onlineImagePath = &#8220;images/myonlineball.png&#8221;;</p>
<p>最后，假如我们对默认的“Learn How”页面不甚满意的话，则还可以对 dojox/off/resources/learnhow.html 进行修改，其对应的 CSS 样式也定义与 dojox/off/resources/offline-widget.css 中。</p>
<p><a name="N102AC">性能问题</a></p>
<p>Dojo Offline 每次在对数据进行同步时，始终都会刷新缓存于本地的资源，这一点有可能会对同步的性能构成较大的影响，因为毕竟并非每一次同步都需要刷新所有的本地数据。为了提高同步的效率，Dojo Offline 提供了一种可选的方案，即由应用程序提供一个名为 version.js 的特殊文件，并将其置于应用程序的主路径下。假如该文件存在的话，则同步期间 Dojo Offline 会去读取该文件的内容，并判断其内容是否改变，以此来选择性的刷新本地缓存文件。</p>
<p>我们在 version.js 文件中所提供的内容其实非常简单，可以是一个字符串，也可以是一个数字，形式不限。例如：&#8221;03-15-2009.9&#8243;。只要能够让 Dojo Offline 判断出内容的变化即可。</p>
<p>除了同步时候的性能问题外，另一个可能会遇到的性能问题是数据的存储。当我们使用 Dojo SQL 来存储数据时，必须先将底层所依赖的 Google Gears 的存储数据库打开，而后才能进行数据的存储，而当数据存储完毕之后，还需将数据库关闭。通常情况下，我们并不需要关心这一点，因为 Dojo SQL 会自动为我们完成这一切，每次当我们执行一句 SQL 语句时，底层代码都会自动处理数据库的打开和关闭。</p>
<p>不过，假如我们是在批量的向本地缓存插入数据的话，比如在一个循环次数为上百次的 for 循环中执行数据插入操作，那么每执行一次 SQL 语句都要打开和关闭一次数据库或许是一种很低效做法。为了提高效率，我们可以在批量操作数据之前通过调用 dojox.sql.open() 手工将数据库打开，等所有操作完成之后后再通过调用 dojox.sql.close() 手工将其关闭。插入数据期间，Dojo SQL 会自动判断数据库的连接状态，并保持连接一直处于打开状态，直至手工关闭为止：<br />
<a name="N102C0"><strong>清单 16</strong></a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>
<pre>var dataSet = getDataSet(); // get an array that has a bunch of data
//in it
dojox.sql.open();
for(var i = 0; i &lt; dataSet.length; i++){
 dojox.sql("INSERT INTO DOCUMENTS (fileName, content) VALUES (?, ?)",
 dataSet[i].fileName, dataSet[i].content);
}
dojox.sql.close();</pre>
</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /><br />
<img src="http://www.ibm.com/i/c.gif" border="0" alt="" width="8" height="6" /></td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" align="right">
<tbody>
<tr align="right">
<td><img src="http://www.ibm.com/i/c.gif" alt="" width="100%" height="4" /></p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" border="0" alt="" width="16" height="16" /></td>
<td align="right" valign="top"><a href="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/#main"><strong>回页首</strong></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p><a name="6. 总结 |outline">总结</a></p>
<p>本文介绍了 Dojo Offline 的强大功能。通过阅读本文，读者能够了解到 Dojo Offline 的基本工作原理和一定的高级定制功能，从而掌握如何使用 Dojo Offline 进行 Web 离线应用程序开发的技能。</p>
<p>申明：</p>
<p>本文仅代表作者个人观点。</p>
<p><a name="resources">参考资料</a></p>
<p><strong>学习</strong></p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Dojo_Toolkit">Dojo 的 Wiki</a>：对 dojo 进行了全面的介绍，是一个入门的好地方。</li>
<li><a href="http://dojotoolkit.org/">Dojo 官方网站</a>：提供了最全面的资料，包括 dojo 源码，各种文档，实例等等。</li>
<li>参考 <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-5-dojox/dojo-offline">Dojo offline</a> 官方文档。</li>
<li><a href="http://dojotoolkit.org/docs">Dojo 官方文档库</a>：在这里您可以找到全部和 Dojo 开发相关的文档资料。</li>
<li>参考 <a href="http://gears.google.com/">Google Gear</a> 相关文档，了解更多 Google Gear 的内容。</li>
<li>参考 W3C <a href="http://www.w3.org/TR/offline-webapps/">Offline Web Applications</a> 规范。</li>
<li><a href="http://www.ibm.com/developerworks/cn/web/wa-dojotoolkit/">developerWorks Dojo 专题</a>：汇集了大量与 Dojo 相关的技术资源。</li>
<li>通过 developerWorks <a href="http://www.ibm.com/developerworks/cn/web/">Web 开发专区</a> 内有关 Web 技术的文章和教程（包括本专栏之前的各期文章）扩展您的站点开发技能。</li>
</ul>
<p><strong>获得产品和技术</strong></p>
<ul>
<li><a href="http://www.ibm.com/developerworks/cn/downloads/">IBM 试用软件</a>：使用这些可直接从 developerWorks 下载的软件构建您的下一个开发项目。</li>
</ul>
<p><strong>讨论</strong></p>
<ul>
<li>通过参与 <a href="http://www.ibm.com/developerworks/blogs/?S_TACT=105AGX52&amp;S_CMP=cn-a-wa">developerWorks blog</a> 加入 developerWorks 社区。</li>
</ul>
<p><a name="author">作者简介</a></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td colspan="3"><img src="http://www.ibm.com/i/c.gif" alt="" width="100%" height="5" /></td>
</tr>
<tr align="left" valign="top">
<td><img src="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/hehuijian.jpg" alt="/developerworks/cn/web/0906_dojo_offline_hehj/hehuijian.jpg" align="left" /></td>
<td><img src="http://www.ibm.com/i/c.gif" alt="" width="4" height="5" /></td>
<td width="100%">何辉剑，现在 IBM 中国软件开发实验室 Lotus 开发中心工作，目前从事 Lotus Quickr 的开发定制以及客户支持工作。对 Dojo，Web2.0 相关技术和社会化软件有丰富的经验。</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td colspan="3"><img src="http://www.ibm.com/i/c.gif" alt="" width="100%" height="5" /></td>
</tr>
<tr align="left" valign="top">
<td><img src="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/zhangshun.jpg" alt="/developerworks/cn/web/0906_dojo_offline_hehj/zhangshun.jpg" align="left" /></td>
<td><img src="http://www.ibm.com/i/c.gif" alt="" width="4" height="5" /></td>
<td width="100%">张顺，现在 IBM 中国软件开发实验室 Lotus 开发中心工作，目前从事 Lotus Quickr 的开发定制以及客户支持工作。对 Web 服务，Web2.0 相关技术有浓厚的兴趣。</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td colspan="3"><img src="http://www.ibm.com/i/c.gif" alt="" width="100%" height="5" /></td>
</tr>
<tr align="left" valign="top">
<td><img src="http://www.ibm.com/developerworks/cn/web/0906_dojo_offline_hehj/moying.jpg" alt="/developerworks/cn/web/0906_dojo_offline_hehj/moying.jpg" align="left" /></td>
<td><img src="http://www.ibm.com/i/c.gif" alt="" width="4" height="5" /></td>
<td width="100%">莫映，现在IBM中国软件开发实验室Lotus开发中心工作，目前从事Lotus Quickr的Platform Service开发。热衷于Web 2.0相关技术及智能Web 2.0应用的构建。</td>
</tr>
</tbody>
</table>
<h2  class="related_post_title">Other Posts / 其他文章</h2><ul class="related_post"><li><a href="http://slj.me/2009/03/cvs-svn-compare/" title="关于CVS和SVN">关于CVS和SVN</a></li><li><a href="http://slj.me/2009/03/php5-__autoload/" title="PHP5: __autoload 自动加载对象">PHP5: __autoload 自动加载对象</a></li><li><a href="http://slj.me/2009/07/zend-framework-1-8-1-start/" title="[转]Zend Framework 1.8.1 Start ">[转]Zend Framework 1.8.1 Start </a></li><li><a href="http://slj.me/2010/05/whats-new-for-meeplace-2-8/" title="What&#8217;s new for Meeplace 2.8">What&#8217;s new for Meeplace 2.8</a></li><li><a href="http://slj.me/2009/03/galleriffic-jquery/" title="Galleriffic-jQuery相片展示插件">Galleriffic-jQuery相片展示插件</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/04/%e8%bd%ac%ef%bc%9a%e4%bd%bf%e7%94%a8-dojo-%e5%bc%80%e5%8f%91%e7%a6%bb%e7%ba%bf%e5%ba%94%e7%94%a8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用回车键提交网页表单的条件</title>
		<link>http://slj.me/2010/03/%e4%bd%bf%e7%94%a8%e5%9b%9e%e8%bd%a6%e9%94%ae%e6%8f%90%e4%ba%a4%e7%bd%91%e9%a1%b5%e8%a1%a8%e5%8d%95%e7%9a%84%e6%9d%a1%e4%bb%b6/</link>
		<comments>http://slj.me/2010/03/%e4%bd%bf%e7%94%a8%e5%9b%9e%e8%bd%a6%e9%94%ae%e6%8f%90%e4%ba%a4%e7%bd%91%e9%a1%b5%e8%a1%a8%e5%8d%95%e7%9a%84%e6%9d%a1%e4%bb%b6/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 16:03:51 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[回车]]></category>
		<category><![CDATA[表单]]></category>

		<guid isPermaLink="false">http://slj.me/2010/03/%e4%bd%bf%e7%94%a8%e5%9b%9e%e8%bd%a6%e9%94%ae%e6%8f%90%e4%ba%a4%e7%bd%91%e9%a1%b5%e8%a1%a8%e5%8d%95%e7%9a%84%e6%9d%a1%e4%bb%b6/</guid>
		<description><![CDATA[回车键提交表单是我们经常操作的一个动作，而什么条件下能使回车键提交却很少有人关心！ 我们有时候希望回车键敲在文本框（input element）里来提交表单（form），但有时候又不希望如此。比如搜索行为，希望输入完关键词之后直接按回车键立即提交表单，而有些复杂表单，可能要避免回车键误操作在未完成表单填写的时候就触发了表单提交。 要控制这些行为，不需要借助JS，浏览器已经帮我们做了这些处理，这里总结几条规则： 1、如果表单里有一个type=”submit”的按钮，回车键生效。 2、如果表单里只有一个type=”text”的input，回车键生效。 3、如果按钮不是用input，而是用button，并且没有加type，IE下默认为type=button，FX默认为type=submit。 4、其他表单元素如textarea、select不影响。 实际应用的时候，要让表单响应回车键很容易，保证表单里有个type=”submit”的按钮就行。而当只有一个文本框又不希望响应回车键怎么办呢？我的方法有点别扭，就是再写一个无意义的文本框，隐藏起来。根据第4条规则，我们在用button的时候，尽量显式声明type以使浏览器表现一致。 一个demo，列出了一些例子 Other Posts / 其他文章从安装GEV.com中学到的语义化的HTML结构到底有何好处? PHP无法操作memcached提示Permission denied的解决方法08腾讯实习生招聘设计类网页重构组岗位公开试题完美兼容IE6，摆脱table用CSS实现图片垂直居中]]></description>
			<content:encoded><![CDATA[<div id="content_body">
<p>回车键提交表单是我们经常操作的一个动作，而什么条件下能使回车键提交却很少有人关心！</p>
<p>我们有时候希望回车键敲在文本框（input element）里来提交表单（form），但有时候又不希望如此。比如搜索行为，希望输入完关键词之后直接按回车键立即提交表单，而有些复杂表单，可能要避免回车键误操作在未完成表单填写的时候就触发了表单提交。</p>
<p>要控制这些行为，不需要借助JS，浏览器已经帮我们做了这些处理，这里总结几条规则：<br />
1、如果表单里有一个type=”submit”的按钮，回车键生效。<br />
2、如果表单里只有一个type=”text”的input，回车键生效。<br />
3、如果按钮不是用input，而是用button，并且没有加type，IE下默认为type=button，FX默认为type=submit。<br />
4、其他表单元素如textarea、select不影响。</p>
<p>实际应用的时候，要让表单响应回车键很容易，保证表单里有个type=”submit”的按钮就行。而当只有一个文本框又不希望响应回车键怎么办呢？我的方法有点别扭，就是再写一个无意义的文本框，隐藏起来。根据第4条规则，我们在用button的时候，尽量显式声明type以使浏览器表现一致。</p>
<p>一个<a href="http://ued.koubei.com/wp-content/uploads/2009/01/submit.html">demo</a>，列出了一些例子</p>
</div>
<h2  class="related_post_title">Other Posts / 其他文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/03/php%e6%a0%bc%e5%bc%8f%e5%8c%96%e6%95%b0%e5%ad%97%ef%bc%9a%e4%bd%8d%e6%95%b0%e4%b8%8d%e8%b6%b3%e5%89%8d%e9%9d%a2%e5%8a%a00%e8%a1%a5%e8%b6%b3/" title="php格式化数字：位数不足前面加0补足">php格式化数字：位数不足前面加0补足</a></li><li><a href="http://slj.me/2009/06/ie6%e5%85%83%e7%b4%a0float%e7%9a%84hack/" title="IE6元素float的hack">IE6元素float的hack</a></li><li><a href="http://slj.me/2010/01/php-magic_quotes_gpc-magic_quotes_runtime/" title="PHP 中 magic_quotes_gpc 和 magic_quotes_runtime 的区别，作用和用法">PHP 中 magic_quotes_gpc 和 magic_quotes_runtime 的区别，作用和用法</a></li><li><a href="http://slj.me/2009/06/louzui/" title="注册漏嘴网">注册漏嘴网</a></li><li><a href="http://slj.me/2010/05/my-footprint/" title="我的电脑情缘（流水帐）">我的电脑情缘（流水帐）</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/%e4%bd%bf%e7%94%a8%e5%9b%9e%e8%bd%a6%e9%94%ae%e6%8f%90%e4%ba%a4%e7%bd%91%e9%a1%b5%e8%a1%a8%e5%8d%95%e7%9a%84%e6%9d%a1%e4%bb%b6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[英,转]45个新鲜有用的JS与jQuery技术和工具</title>
		<link>http://slj.me/2010/03/45-fresh-useful-javascript-and-jquery-techniques-and-tools/</link>
		<comments>http://slj.me/2010/03/45-fresh-useful-javascript-and-jquery-techniques-and-tools/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 06:10:09 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[工具]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1617</guid>
		<description><![CDATA[45 Fresh Useful JavaScript and jQuery Techniques and Tools Yes, this is another round-up of fresh and useful Javascript techniques, tools and resources. But don’t close the tab yet, as you might find this one very useful. In this selection we present calendars, forms, buttons, navigation, debugging, optimization and compatibility tables as well as handy [...]]]></description>
			<content:encoded><![CDATA[<h2>45 Fresh Useful JavaScript and jQuery Techniques and Tools</h2>
<p>Yes, this is another round-up of <strong>fresh and useful Javascript techniques, tools and resources</strong>. But don’t close the tab yet, as you might find this one very useful. In this selection we present calendars, forms, buttons, navigation, debugging, optimization and compatibility tables as well as handy resources and tools. We also cover various jQuery-plugins that will help you extend the functionality of your website and improve user experience with ready components or coding solutions.</p>
<p>The last section also covers a number of useful educational resources such as a compilation of useful JavaScript coding practices, a detailed comparison of JavaScript frameworks and general JavaScript programming conventions. We are looking forward to your feedback.</p>
<p><span id="more-1617"></span>You may be interested in the following related posts:</p>
<ul>
<li><a rel="external nofollow" href="http://www.smashingmagazine.com/2009/06/21/50-fresh-javascript-tools-that-will-improve-your-workflow/">50 Fresh JavaScript Tools That Will Improve Your Workflow</a></li>
<li><a rel="external nofollow" href="http://www.smashingmagazine.com/2010/01/12/45-powerful-css-javascript-techniques/">45 Powerful CSS/JavaScript-Techniques</a></li>
<li><a rel="external nofollow" href="http://www.smashingmagazine.com/2009/03/08/70-new-useful-ajax-and-javascript-techniques/">70 Useful AJAX And JavaScript Techniques</a></li>
</ul>
<p>[By the way, did you know there is a brand new <a rel="external nofollow" href="http://creatives.commindo-media.de/www/delivery/ck.php?oaparams=2__bannerid=1339__zoneid=0__cb=a279a7c66d__oadest=http%3A%2F%2Fshop.smashingmagazine.com%2Fsmashingbook-dispatcher.php%3Fd%3Dsmashing-wordpress%26utm_source%3DSmashing%252BMagazine%26utm_medium%3Deditorialbox2%26utm_campaign%3DSmashing%252BWordPress%2520-%2520BTW%2520Editorial%2520Box">Smashing WordPress Book</a>? Push WordPress past its limits!]</p>
<h3>Calendars and Timelines</h3>
<p><a rel="external nofollow" href="http://www.radoslavdimov.com/jquery-plugins/jquery-plugin-digiclock/">jDigiClock – Digital Clock (HTC Hero inspired)</a><br />
jDigiClock is a jQuery plugin inspired from HTC Hero Clock Widget.</p>
<p><a rel="external nofollow" href="http://www.radoslavdimov.com/jquery-plugins/jquery-plugin-digiclock/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-82.jpg" alt="Javascript-techniques-82 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://home.comcast.net/~vonholdt/test/clock_slide/index.htm">jQuery Sliding Clock v1.1</a><br />
jQuery transpearant Slider clock with CSS sprites.</p>
<p><a rel="external nofollow" href="http://home.comcast.net/~vonholdt/test/clock_slide/index.htm"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-67.jpg" alt="Javascript-techniques-67 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://home.jongsma.org/software/js/datepicker">Date / Time Picker</a><br />
Note that this control is not designed to work in IE6; although it will function correctly in most cases, the positioning of the calendar may be way off depending on how your page is styled.</p>
<p><a rel="external nofollow" href="http://home.jongsma.org/software/js/datepicker"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-05.jpg" alt="Javascript-techniques-05 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<h3>JavaScript Debugging and Validation Tools</h3>
<p><a rel="external nofollow" href="http://www.mozilla.org/projects/venkman/">Venkman JavaScript Debugger project page</a><br />
Venkman is the code name for Mozilla’s JavaScript Debugger. Venkman aims to provide a powerful JavaScript debugging environment for Gecko-based browsers namely Firefox 3.x, the Netscape 7.x series of browsers, Netscape 9.x series, Mozilla Seamonkey 1.x and Mozilla Seamonkey 2.x. It does not include Gecko-based browsers such as K-Meleon 1.x, Galeon 2.x and Netscape 8.x. The debugger is available as an add-on package in XPI format. Venkman JavaScript Debugger has been provided as part of the Mozilla install distribution since October 3rd 2001.</p>
<p><a rel="external nofollow" href="http://www.mozilla.org/projects/venkman/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-14.jpg" alt="Javascript-techniques-14 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.my-debugbar.com/wiki/CompanionJS/HomePage">CompanionJS</a><br />
Companion.JS (pronounced Companion dot JS or CJS) is a Javascript debugger for IE.</p>
<p><a rel="external nofollow" href="http://www.my-debugbar.com/wiki/CompanionJS/HomePage"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-32.jpg" alt="Javascript-techniques-32 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://net.tutsplus.com/tutorials/javascript-ajax/how-to-test-your-javascript-code-with-qunit/">How to Test your JavaScript Code with QUnit</a><br />
QUnit is a powerful JavaScript unit testing framework that helps you to debug code. It’s written by members of the jQuery team, and is the official test suite for jQuery. But QUnit is general enough to test any regular JavaScript code, and it’s even able to test server-side JavaScript via some JavaScript engine like Rhino or V8.</p>
<p><a rel="external nofollow" href="http://net.tutsplus.com/tutorials/javascript-ajax/how-to-test-your-javascript-code-with-qunit/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-44.jpg" alt="Javascript-techniques-44 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://jsbin.com/">JS Bin – Collaborative JavaScript Debugging</a><br />
JS Bin is an open source collaborative JavaScript debugging tool.</p>
<p><a rel="external nofollow" href="http://jsbin.com/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-12.jpg" alt="Javascript-techniques-12 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<h3>Forms, Buttons &amp; Navigation</h3>
<p><a rel="external nofollow" href="http://tutorialzine.com/2009/10/google-wave-history-slider-jquery/">Making a Google Wave History Slider</a><br />
Here is shown how to create a Google Wave-like history slider. Using it will enable visitors to go back and forth in time to view the changes that take place on a comment thread.</p>
<p><a rel="external nofollow" href="http://tutorialzine.com/2009/10/google-wave-history-slider-jquery/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-73.jpg" alt="Javascript-techniques-73 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://theodin.co.uk/blog/design/fancy-radio-buttons-jquery.html">Fancy Radio Buttons With jQuery</a><br />
Creation of 2 mandatory option sets that a user could choose, while hiding off the radio button inputs and using an anchor links to make it a bit more usable.</p>
<p><a rel="external nofollow" href="http://theodin.co.uk/blog/design/fancy-radio-buttons-jquery.html"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-62.jpg" alt="Javascript-techniques-62 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.tutorial9.net/web-tutorials/creative-button-animations-with-sprites-and-jquery-part-2/">Creative Button Animations with Sprites and JQuery</a><br />
Fading hover effect for which the transition is smoothed with JavaScript, using jQuery library.</p>
<p><a rel="external nofollow" href="http://www.tutorial9.net/web-tutorials/creative-button-animations-with-sprites-and-jquery-part-2/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-83.jpg" alt="Javascript-techniques-83 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.vileworks.com/password-unmasking">Password (un)Masking</a><br />
JavaScript jQuery that toggles the masking and unmasking of the password field.</p>
<p><a rel="external nofollow" href="http://www.vileworks.com/password-unmasking"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-68.jpg" alt="Javascript-techniques-68 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://css-tricks.com/jquery-magicline-navigation/">jQuery MagicLine Navigation</a><br />
These “sliding” style navigation bars have been around a while, and turns out it’s really pretty darn easy. Here are put two examples together.</p>
<p><a rel="external nofollow" href="http://css-tricks.com/jquery-magicline-navigation/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-49.jpg" alt="Javascript-techniques-49 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://tympanus.net/codrops/2009/12/11/fixed-fade-out-menu-a-css-and-jquery-tutorial/">Fixed Fade Out Menu: A CSS and jQuery Tutorial</a><br />
The aim is to have a fixed navigation that follows the user when he scrolls, and only subtly showing itself by fading out and becoming almost transparent. When the user hovers over it, the menu then becomes opaque again. Inside of the navigation we will have some links, a search input and a top and bottom button that let the user navigate to the top or the bottom of the page.</p>
<p><a rel="external nofollow" href="http://tympanus.net/codrops/2009/12/11/fixed-fade-out-menu-a-css-and-jquery-tutorial/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-52.jpg" alt="Javascript-techniques-52 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://cssglobe.com/post/7161/jquery-plugin-simplest-twitterlike-dynamic-character-count-for-textareas">jQuery plugin: Simplest Twitter-like dynamic character count for textareas and input fields</a><br />
The best way to explain what this plugin does is to mention Twitter. Twitter posts are limited to 140 characters. While typing the Twitter post there is this always present information about how many characters the users have before reaching the limit. The information is not only provided merely by displaying a number, there are different colors applied to certain stages to notify the user about the status.</p>
<p><a rel="external nofollow" href="http://www.csskarma.com/blog/sliding-labels-v2/">Sliding Labels v2</a><br />
Form label keeping the label inline, but sliding it off to the left rather than going away on click.</p>
<p><a rel="external nofollow" href="http://www.csskarma.com/blog/sliding-labels-v2/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2010/03/javascript-techniques-87.jpg" alt="Javascript-techniques-87 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="100" /></a></p>
<p><a rel="external nofollow" href="http://demos.usejquery.com/ketchup-plugin/index.html">Ketchup Plugin</a><br />
Ketchup is a slim jQuery Plugin that validates your forms. It aims to be very flexible and extendable for its appearance and functionality.</p>
<p><a rel="external nofollow" href="http://demos.usejquery.com/ketchup-plugin/index.html"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-84.jpg" alt="Javascript-techniques-84 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<h3>Layout tools</h3>
<p><a rel="external nofollow" href="http://www.kromosome.net/cssdesignergrid/">jQuery {css}designerGrid Plugin</a><br />
{css} designerGrid is A jQuery Plugin developed for website interface developers who use the grid system of layout. {css} designerGrid is intended to assist these developers with CSS prototyping.</p>
<p><a rel="external nofollow" href="http://www.kromosome.net/cssdesignergrid/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-80.jpg" alt="Javascript-techniques-80 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://code.google.com/p/css-template-layout/">css-template-layout</a><br />
JavaScript (jQuery) implementation of the CSS Template Layout Module</p>
<p><a rel="external nofollow" href="http://code.google.com/p/css-template-layout/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-33.jpg" alt="Javascript-techniques-33 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://blog.creativityden.com/fluid-grid-using-jquery/">How to create a fluid grid with jQuery</a><br />
Grid-based layout is probably the more preferred way to style up a webpage to give it more magazine-like look and feel. This tutorial is about how to use CSS and Javascript to create a fluid grid-based layout (See demo here). The algorithm/procedure used in this tutorial is very simple and straightforward. There are more advanced algorithms out there which can handle multiple scenarios. But the purpose is to understand the basic logic on how to create such layout. So here it goes…</p>
<p><a rel="external nofollow" href="http://blog.creativityden.com/fluid-grid-using-jquery/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-51.jpg" alt="Javascript-techniques-51 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://code.google.com/p/closure-templates/">closure-templates</a><br />
Closure Templates are a client- and server-side templating system that helps you dynamically build reusable HTML and UI elements. They are easy to learn and customizable to fit your application’s needs. Closure Templates support JavaScript and Java and use a data model and expression syntax that works for either language. You can also use the built-in message support to easily localize your applications.</p>
<p><a rel="external nofollow" href="http://code.google.com/p/closure-templates/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-46.jpg" alt="Javascript-techniques-46 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<h3>Useful jQuery Plugins</h3>
<p><a rel="external nofollow" href="http://code.drewwilson.com/entry/tiptip-jquery-plugin">TipTip jQuery Plugin</a><br />
TipTip detects the edges of the browser window and will make sure the tooltip stays within the current window size. As a result the tooltip will adjust itself to be displayed above, below, to the left or to the right of the element with TipTip applied to it, depending on what is necessary to stay within the browser window. TipTip is a very lightweight and intelligent custom tooltip jQuery plugin. It uses ZERO images and is completely customizable via CSS. It’s also only 3.5kb minified!</p>
<p><a rel="external nofollow" href="http://code.drewwilson.com/entry/tiptip-jquery-plugin"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-65.jpg" alt="Javascript-techniques-65 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://fredhq.com/projects/roundabout/">jQuery Roundabout</a><br />
Roundabout is a jQuery plugin that converts a structure of static HTML elements into a highly customizable turntable-like interactive area. (And now, not just turntables, but many shapes!)</p>
<p><a rel="external nofollow" href="http://fredhq.com/projects/roundabout/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-69.jpg" alt="Javascript-techniques-69 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://jparse.kylerush.net/">jParse – jQuery XML Parse Plugin</a><br />
jParse is a jQuery plugin that allows you to parse XML that was fetched with the jQuery .ajax method (making it fully customizable).</p>
<p><a rel="external nofollow" href="http://jparse.kylerush.net/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-72.jpg" alt="Javascript-techniques-72 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://razorjack.net/quicksand/">jQuery Quicksand plugin</a><br />
Reorder and filter items with a nice shuffling animation.</p>
<p><a rel="external nofollow" href="http://razorjack.net/quicksand/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-48.jpg" alt="Javascript-techniques-48 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://thinkinginweb.com/sections/articles/18-11-2009-typeQuery-change-website-typography-with-jquery.aspx">typeQuery, change website typography with jquery</a><br />
typeQuery gives the flexibility to change the font-family for everything you define with class, id, or tag, this example is referring to the selected item on a select object with id=”tag” and the font-family value at select object with id=”family”: <code>$($("#tag").val()).css("font-family", $("#family").val());</code></p>
<p><a rel="external nofollow" href="http://thinkinginweb.com/sections/articles/18-11-2009-typeQuery-change-website-typography-with-jquery.aspx"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-70.jpg" alt="Javascript-techniques-70 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://lab.smashup.it/flip/">Flip! A jQuery plugin v0.9.9</a><br />
Flip is a jQuery plugin that will flip easily your elements in four directions.</p>
<p><a rel="external nofollow" href="http://lab.smashup.it/flip/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-55.jpg" alt="Javascript-techniques-55 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.webresourcesdepot.com/data-encryption-with-javascript-jcryption/">Data Encryption With JavaScript: jCryption</a><br />
jCryption is a jQuery plugin for encrypting POST/GET data submitted by forms. It uses public-key algorithm of RSA for the encryption &amp; has a PHP file for handling the decryption of data.</p>
<p><a rel="external nofollow" href="http://www.webresourcesdepot.com/data-encryption-with-javascript-jcryption/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-24.jpg" alt="Javascript-techniques-24 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://trif3cta.com/blog/entry/jquery-plugins-under-4k/">Minimalist jQuery: 11 useful plugins under 4K</a><br />
jQuery makes our lives easier. So much so that it’s tempting to use it all the time, inadvertently slowing our page load times (cue <a rel="external nofollow" href="http://developer.yahoo.com/yslow/">YSlow</a> and <a rel="external nofollow" href="http://stevesouders.com/hammerhead/">Hammerhead</a>). Combining, compressing, and delivering scripts at the end of your page helps in the HTTP request department. On the file size front, below are jQuery plugins that give solid bang for your performance buck.</p>
<p><a rel="external nofollow" href="http://trif3cta.com/blog/entry/jquery-plugins-under-4k/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-79.jpg" alt="Javascript-techniques-79 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://jscott.me/jquery.undoable.html">Undo/Redo in jQuery</a><br />
An easy-to-use plugin for adding undo/redo capabilities to a jQuery application. It is based loosely on the Objective-C/Cocoa way of doing things.</p>
<p><a rel="external nofollow" href="http://jscott.me/jquery.undoable.html"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-81.jpg" alt="Javascript-techniques-81 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://code.google.com/p/editease/">editease</a><br />
editEase – jQuery CMS | no fuss, no database, no worries</p>
<p><a rel="external nofollow" href="http://code.google.com/p/editease/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-78.jpg" alt="Javascript-techniques-78 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.jgc.org/blog/2009/10/what-is-jshub.html">jsHub</a><br />
jsHub is a single piece of JavaScript (a “tag”) that can handle reading different sorts of page information and then send them to many different vendors’ products. One piece of code to send to Google Analytics, Omniture SiteCatalyst, WebTrends and Mixpanel. Instead of one piece of JavaScript per vendor, jsHub has a single piece of code (the “hub”) and plugins that know how to translate into the required wire protocol for each vendor. Vendors only maintain the plugin for their product.</p>
<p><a rel="external nofollow" href="http://www.jgc.org/blog/2009/10/what-is-jshub.html"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-22.jpg" alt="Javascript-techniques-22 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<h3>Educational JavaScript Resources and Tutorials</h3>
<p><a rel="external nofollow" href="http://justin.harmonize.fm/index.php/2009/09/an-introduction-to-javascripts-this/">Caffeinated Simpleton </a><br />
JavaScript is an amazing little language, but it’s got some quirks that turn a lot of people off. One of those quirks is <code>this</code>, and how it’s not necessarily what you expect it to be. <code>this</code> isn’t that complicated, but there are very few explanations of how it works on the internet. This article is an attempt to explain how <code>this</code> works and how to use it properly.</p>
<p><a rel="external nofollow" href="http://justin.harmonize.fm/index.php/2009/09/an-introduction-to-javascripts-this/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-07.jpg" alt="Javascript-techniques-07 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.smashingmagazine.com/2009/08/01/what-you-need-to-know-about-javascript-scope/">What You Need To Know About JavaScript Scope</a><br />
This article discusses how JavaScript handles scope and how various JavaScript libraries provide methods for dealing with it and how they smooth out a few bumps. We’ll also look at how you can get back to basics and do some interesting scope wrangling without a library, a useful approach if you’re writing code that needs to stand alone.</p>
<p><a rel="external nofollow" href="http://www.smashingmagazine.com/2009/08/01/what-you-need-to-know-about-javascript-scope/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-25.jpg" alt="Javascript-techniques-25 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://ejohn.org/apps/learn/">Learning Advanced JavaScript</a><br />
A very nice tutorial to learn JavaScript, containing code and discussion from the upcoming book Secrets of the JavaScript Ninja by John Resig.</p>
<p><a rel="external nofollow" href="http://ejohn.org/apps/learn/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-30.jpg" alt="Javascript-techniques-30 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.brucelawson.co.uk/2010/highlight-search-terms-automagically-with-javascript-and-mark/">Highlight search terms automagically with JavaScript and mark</a><br />
Script surrounding the search term(s) with the <code>mark</code> element rather than a <code>span</code>, although the class <var>searchword</var> is retained in case you want to style these <code>mark</code>s differently from others. In the CSS, the rule <code>article mark </code>is just added to turn it a gentle shade of pink.</p>
<p><a rel="external nofollow" href="http://net.tutsplus.com/tutorials/javascript-ajax/10-super-helpful-traversing-functions-in-jquery/">10 Really Helpful Traversing Functions in jQuery</a><br />
With jQuery, selecting HTML elements is laughably easy. But at times, we may wish to further refine the selection, which can be a hassle when the HTML structure is complicated. In this tutorial, we’ll explore ten ways that we can refine and extend a set of wrapped elements that we wish to operate upon.</p>
<p><a rel="external nofollow" href="http://net.tutsplus.com/tutorials/javascript-ajax/10-super-helpful-traversing-functions-in-jquery/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-74.jpg" alt="Javascript-techniques-74 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.catswhocode.com/blog/using-keyboard-shortcuts-in-javascript">Using keyboard shortcuts in Javascript</a><br />
If you want to enhance your web app, Javascript keyboards shortcuts is definitely something to consider. In this article, you’ll learn to use JS keyboard shortcuts, with and without the JQuery framework.</p>
<p><a rel="external nofollow" href="http://www.catswhocode.com/blog/using-keyboard-shortcuts-in-javascript"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-29.jpg" alt="Javascript-techniques-29 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://javascript.crockford.com/code.html">Code Conventions for the JavaScript Programming Language</a><br />
This is a set of coding conventions and rules for use in JavaScript programming.</p>
<p><a rel="external nofollow" href="http://javascript.crockford.com/code.html"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-31.jpg" alt="Javascript-techniques-31 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.myphpetc.com/2009/03/jquery-select-element-cheat-sheet.html">jQuery – Select element cheat sheet</a><br />
This cheat sheet helps you to find the index of a selected option, set the selected option by value, set the selected option by text, insert a new option before or after another and get the text or value of the selected option.</p>
<p><a rel="external nofollow" href="http://www.myphpetc.com/2009/03/jquery-select-element-cheat-sheet.html"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-76.jpg" alt="Javascript-techniques-76 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.ibm.com/developerworks/web/library/wa-jsframeworks/index.html">Compare JavaScript frameworks</a><br />
Modern Web sites and Web applications tend to rely quite heavily on client-side JavaScript to provide rich interactivity, particularly through the advent of asynchronous HTTP requests that do not require page refreshes to return data or responses from a server-side script or database system. In this article, you will discover how JavaScript frameworks make it easier and faster to create highly interactive and responsive Web sites and Web applications.</p>
<p><a rel="external nofollow" href="http://www.ibm.com/developerworks/web/library/wa-jsframeworks/index.html"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-77.jpg" alt="Javascript-techniques-77 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://dailyjs.com/2010/01/27/pro-practices-1/">Park your Horse, Code Cowboy: Professional JavaScript Workflows, Part 1</a><br />
In this series, we’ll talk about tools &amp; techniques you can use to cover those No’s, and cut a lot of strife &amp; embarrassment from your JavaScript experience.</p>
<p><a rel="external nofollow" href="http://dailyjs.com/2010/01/27/pro-practices-1/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-47.jpg" alt="Javascript-techniques-47 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://www.java2s.com/Code/JavaScriptReference/CatalogJavaScriptReference.htm">JavaScript Reference examples (example source code)</a><br />
JavaScript Reference examples, organized by Objects, Properties, Methods &amp; Collections. Some Event Handlers Reference are also available.</p>
<p><a rel="external nofollow" href="http://www.java2s.com/Code/JavaScriptReference/CatalogJavaScriptReference.htm"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-20.jpg" alt="Javascript-techniques-20 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://dev.opera.com/articles/view/javascript-best-practices/">JavaScript best practices</a><br />
A compilation of best practices and good advice I’ve amassed over the years, much of it learnt the hard way (experimentation and suchlike). Take the advice below to heart and keep it in a part of your brain that has a quick access route so you can apply it without thinking about it. I am sure you will find things to disagree with, and that is a good thing – you should question what you read, and strive to find better solutions. However, I have found that following these principles has made me a more effective developer and allowed other developers to build upon my work more easily.</p>
<p><a rel="external nofollow" href="http://dev.opera.com/articles/view/javascript-best-practices/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-15.jpg" alt="Javascript-techniques-15 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p><a rel="external nofollow" href="http://wtfjs.com/">wtfjs</a><br />
JavaScript is a language we love despite it giving us so much to hate. This is a collection of those very special irregularities, inconstancies and just plain painfully unintuitive moments for the language of the web.</p>
<p><a rel="external nofollow" href="http://wtfjs.com/"><img src="http://slj.me/wp-content/uploads/2010/03/javascript-techniques-41.jpg" alt="Javascript-techniques-41 in 45 Fresh Useful JavaScript and jQuery Techniques and Tools" width="480" height="300" /></a></p>
<p>转自：http://www.smashingmagazine.com/2010/03/12/45-fresh-useful-javascript-and-jquery-techniques-and-tools/</p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2009/04/jquery-float-menu/" title="一个利用jQuery实现菜单跟随页面滚动而移动的代码">一个利用jQuery实现菜单跟随页面滚动而移动的代码</a></li><li><a href="http://slj.me/2009/04/dreamweaver-jquery-code-association/" title="在Dreamweaver中加入jQuery代码编写联想提示">在Dreamweaver中加入jQuery代码编写联想提示</a></li><li><a href="http://slj.me/2009/03/galleriffic-jquery/" title="Galleriffic-jQuery相片展示插件">Galleriffic-jQuery相片展示插件</a></li><li><a href="http://slj.me/2009/03/nyromodal-jquery-plugin/" title="NyroModal-jQuery的一个遮罩层插件">NyroModal-jQuery的一个遮罩层插件</a></li><li><a href="http://slj.me/2010/12/javascript-select-operations/" title="JavaScript 操作select控件大全（新增、修改、删除、选中、清空、判断存在等）">JavaScript 操作select控件大全（新增、修改、删除、选中、清空、判断存在等）</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/45-fresh-useful-javascript-and-jquery-techniques-and-tools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>“点亮网页”：一个实用的Firefox和IE插件</title>
		<link>http://slj.me/2010/03/light-web-useful-firefox-ie-plugin/</link>
		<comments>http://slj.me/2010/03/light-web-useful-firefox-ie-plugin/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 07:30:17 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[light web]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1608</guid>
		<description><![CDATA[支付宝UED的鸽子同学制作了一个Firefox插件，它可以用来快速实时编辑网页代码，快速基于Firefox制作Demo页面，方便的编辑修改CSS Sprite，以及配合Fiddler调试页面，是一个很不错的前端开发助手。 Firefox版本 该插件基于Firebug，所以安装前请确保已经安装Firebug。 一些主要特性； 即时编辑——即改即现，把Firefox打造成超强网页编辑器； 与Fiddler一起使用，快速调试线上网页，HTML代码快速生成； 刷新CSS，DOM不刷新； 禁用单个CSS样式； CSS Sprites位置快速设定； 保持Session不过期； 导出任意节点为PNG图片； 现在就安装（从火狐官方下载1.6版） 下载1.7版本低安装 via ued.alipay.com 推荐查看作者的博客，里面有几篇介绍该插件的文章。你也可以查看Alipay的UED的介绍。 IE版 非常不错的是，该插件同时也提供了一个IE版本，安装很方便就是下载文件：http://nihaoku.cn/Linr/LinrIEGallery.reg 下载下来后运行reg文件，右键菜单就会出现“点亮网页”选项，重启IE内核的浏览器，然后右键选择“点亮网页”即可使用。 推荐查看IE版本的官方介绍。 另外作者在博客中透露Chrome版本也在开发中，很快就会面世，让我们一起期待吧。 查看点亮网页+Fiddler的视频演示 查看LinrLightWeb(Firefox Add-on)功能浏览 下载观看点亮网页操作CSS Sprite的动画 Related Posts / 相关文章CSS半透明度设置归纳总结[Firefox,IE,Chrome,Safari]关于一些浏览器的的Hack几款IE的调试工具为网页开发者准备的13个Google Chrome浏览器扩展20个Web设计师必要的Firefox插件]]></description>
			<content:encoded><![CDATA[<p>支付宝UED的<a href="http://hi.baidu.com/vickeychen" target="_blank">鸽子同学</a>制作了一个Firefox插件，它可以用来快速实时编辑网页代码，快速基于Firefox制作Demo页面，方便的编辑修改CSS  Sprite，以及配合Fiddler调试页面，是一个很不错的前端开发助手。</p>
<h3>Firefox版本</h3>
<p>该插件基于Firebug，所以安装前请确保已经安装Firebug。</p>
<p><img title="linrlightweb" src="http://slj.me/wp-content/uploads/2010/03/linrlightweb-e1262185707887.png" alt="" width="500" height="200" /></p>
<p>一些主要特性；</p>
<ul>
<li>即时编辑——即改即现，把Firefox打造成超强网页编辑器；</li>
<li>与Fiddler一起使用，快速调试线上网页，HTML代码快速生成；</li>
<li>刷新CSS，DOM不刷新；</li>
<li>禁用单个CSS样式；</li>
<li>CSS Sprites位置快速设定；</li>
<li>保持Session不过期；</li>
<li>导出任意节点为PNG图片；</li>
</ul>
<p><span id="more-1608"></span><a href="https://addons.mozilla.org/zh-CN/firefox/addon/14068" target="_blank">现在就安装（从火狐官方下载1.6版）</a></p>
<p><a href="http://ued.alipay.com/wp-content/uploads/LinrLightWeb.xpi" target="_blank">下载1.7版本低安装 via ued.alipay.com</a></p>
<p>推荐查看<a href="http://hi.baidu.com/vickeychen" target="_blank">作者的博客</a>，里面有几篇介绍该插件的文章。你也可以查看<a href="http://ued.alipay.com/2009/12/linrlightweb-firefox-addon/" target="_blank">Alipay的UED的介绍</a>。</p>
<h3>IE版</h3>
<p>非常不错的是，该插件同时也提供了一个IE版本，安装很方便就是下载文件：<a href="http://nihaoku.cn/Linr/LinrIEGallery.reg">http://nihaoku.cn/Linr/LinrIEGallery.reg</a> 下载下来后运行reg文件，右键菜单就会出现“点亮网页”选项，重启IE内核的浏览器，然后右键选择“点亮网页”即可使用。</p>
<p><img title="linrlightwebie" src="http://slj.me/wp-content/uploads/2010/03/linrlightwebie-e1262186235883.png" alt="" width="500" height="400" /></p>
<p>推荐查看<a href="http://hi.baidu.com/vickeychen/blog/item/41cb3e12a143a25af919b844.html" target="_blank">IE版本的官方介绍</a>。</p>
<p>另外作者在博客中透露<strong>Chrome版本也在开发中</strong>，很快就会面世，让我们一起期待吧。</p>
<p>查看<a href="http://msbluelight-0.agappdom.net/e1/d/20709/586316/63397900800/0.0_6SXczxkjhJBWkJIUDJOfnggIc/zziframehtml1zz.html#%2fStartWithParent%2fappId%2f%2f%2f%2f%2f%2f%2f%2ftrue%2f1.0%2f5%2fMicrosoftAjax.js%2fBasePlayer.js%2fPlayerStrings.js%2fplayer.js%2fStartPlayer.js%2fvideo%253dhttp%253a%252f%252fmsbluelight-0.agappdom.net%252fe1%252fd%252f110178%252f23726156%252f63397900800%252f0.37F6b89teu_fHF2Zo9vYZa7UxkE%252fvideo.wmv" target="_blank">点亮网页+Fiddler的视频演示</a><br />
查看<a href="http://outgoing.mozilla.org/v1/f6fcf3e34392d70242d4b68876fa82d2247cac5d/http%3A//silverlight.services.live.com/invoke/110178/LinrLightWeb%28Firefox%2520Add-on%29%25E5%258A%259F%25E8%2583%25BD%25E6%258A%25BD%25E6%25A0%25B7%25E6%25BC%2594%25E7%25A4%25BA/iframe.html" target="_blank">LinrLightWeb(Firefox Add-on)功能浏览<br />
</a>下载观看<a href="http://cid-c0bacd534ec9e6a7.skydrive.live.com/self.aspx/%E7%82%B9%E4%BA%AE%E7%BD%91%E9%A1%B5IE%E7%89%88%E6%BC%94%E7%A4%BA%E8%A7%86%E9%A2%91/CSS%20Sprites%E5%BF%AB%E9%80%9F%E8%AE%BE%E7%BD%AE.swf" target="_blank">点亮网页操作CSS Sprite的动画</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2009/04/css-alpha-opacity-setting-for-firefox-ie-chrome-safari/" title="CSS半透明度设置归纳总结[Firefox,IE,Chrome,Safari]">CSS半透明度设置归纳总结[Firefox,IE,Chrome,Safari]</a></li><li><a href="http://slj.me/2009/03/browser_css_hack_ie_ff/" title="关于一些浏览器的的Hack">关于一些浏览器的的Hack</a></li><li><a href="http://slj.me/2010/03/ie-debug-tool/" title="几款IE的调试工具">几款IE的调试工具</a></li><li><a href="http://slj.me/2010/03/13-google-chrome-plugin/" title="为网页开发者准备的13个Google Chrome浏览器扩展">为网页开发者准备的13个Google Chrome浏览器扩展</a></li><li><a href="http://slj.me/2009/11/top-20-essential-firefox-add-ons-for-web-designers/" title="20个Web设计师必要的Firefox插件">20个Web设计师必要的Firefox插件</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/light-web-useful-firefox-ie-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[转]CSS文字排版终极指南</title>
		<link>http://slj.me/2010/03/ultimate-guide-css-text-typography/</link>
		<comments>http://slj.me/2010/03/ultimate-guide-css-text-typography/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 06:56:47 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1603</guid>
		<description><![CDATA[在今天的设计中，排版常常被忽视，特别是被网页设计师忽视。这真是件遗憾的事情因为CSS可以做很多事情来控制我们的排版。也就是说，我们被局限于某些“网络安全”排版，但是我们不应该限制我们自己的创造性。本文整理了一些用于在网页上排版的CSS技巧。 Font属性 CSS提供了font属性，它允许我们在我们的页面中调整文字。这是一系列的关于语法和如何使用CSS调整文字的概述。 Font-size 使用font-size可以修改你的文字的大小。 1 2 3 font-size: 1.2em; font-size: 12px; font-size: 10pt; 预览 文字大小为1.2em. 文字大小为12px. 文字大小为10pt. PS:关于font-size，推荐一下码头写的《http://www.css88.com/archives/821》 Font-weight 该属性用来改变你的文字的粗细(比如bold, bolder) 1 2 3 4 font-weight: normal; font-weight: bold; font-weight: bolder; font-weight: lighter; 预览 font-weight设置为normal font-weight设置为bold font-weight设置为bolder font-weight设置为lighter font-weight属性还可以使用100,200,300,400,500,600,700,800,900等数字值，数字越大，文字越粗。400等效于normal，700等效于bold。 Text-transform text-transform属性允许你应用uppercase(大写), lowercase(小写), 以及capitalize(首字母大写)等效果到你的文字。当然，该属性不能用于中文。 1 2 3 4 text-transform: capitalize; text-transform: uppercase; text-transform: lowercase; text-transform: [...]]]></description>
			<content:encoded><![CDATA[<p>在今天的设计中，排版常常被忽视，特别是被网页设计师忽视。这真是件遗憾的事情因为CSS可以做很多事情来控制我们的排版。也就是说，我们被局限于某些“网络安全”排版，但是我们不应该限制我们自己的创造性。本文整理了一些用于在网页上排版的CSS技巧。</p>
<p><span id="more-11794"></span></p>
<h2>Font属性</h2>
<p>CSS提供了font属性，它允许我们在我们的页面中调整文字。这是一系列的关于语法和如何使用CSS调整文字的概述。</p>
<h3>Font-size</h3>
<p>使用<em>font-size</em>可以修改你的文字的大小。</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.2em</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10pt</span><span style="color: #00AA00;">;</span></pre>
</td>
</tr>
</table>
</div>
<h5>预览</h5>
<ol style="background: #f5f5f5; padding: 20px 0px 20px 30px; border: 1px solid #ddd;">
<li style="font-size: 1.2em;">文字大小为1.2em.</li>
<li style="font-size: 12px;">文字大小为12px.</li>
<li style="font-size: 10pt;">文字大小为10pt.</li>
</ol>
<p>PS:关于font-size，推荐一下码头写的《<a href="http://www.css88.com/archives/821" target="_blank">http://www.css88.com/archives/821</a>》</p>
<h3>Font-weight</h3>
<p>该属性用来改变你的文字的粗细(比如bold, bolder)</p>
<p> <span id="more-1603"></span></p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bolder</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">lighter</span><span style="color: #00AA00;">;</span></pre>
</td>
</tr>
</table>
</div>
<h5>预览</h5>
<ol style="background: #f5f5f5; padding: 20px 0px 20px 30px; border: 1px solid #ddd;">
<li style="font-weight: normal;">font-weight设置为normal</li>
<li style="font-weight: bold;">font-weight设置为bold</li>
<li style="font-weight: bolder;">font-weight设置为bolder</li>
<li style="font-weight: lighter;">font-weight设置为lighter</li>
</ol>
<p>font-weight属性还可以使用100,200,300,400,500,600,700,800,900等数字值，数字越大，文字越粗。400等效于normal，700等效于bold。</p>
<h3>Text-transform</h3>
<p>text-transform属性允许你应用uppercase(大写), lowercase(小写), 以及capitalize(首字母大写)等效果到你的文字。当然，该属性不能用于中文。</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">capitalize</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">lowercase</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span></pre>
</td>
</tr>
</table>
</div>
<h5>预览</h5>
<ol style="background: #f5f5f5; padding: 20px 0px 20px 30px; border: 1px solid #ddd;">
<li style="text-transform: capitalize;">Capitalizes the first letter in every word</li>
<li style="text-transform: uppercase;">Allows your html to be lower case the converts it all to uppercase characters</li>
<li style="text-transform: lowercase;">ALLOWS YOUR HTML TO BE UPPERCASE THEN CONVERTS IT TO LOWERCASE, THIS WAS TYPED IN ALLCAPS</li>
<li style="text-transform: inherit;">inherits the text-transform property from its parent element</li>
</ol>
<h3>Text-decoration</h3>
<p>text-transform属性允许你使用一些文字修饰，比如下划线(underline)、上划线(overline)、删除线(line-through)以及文字闪动(blink)。</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">underline</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">overline</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">line-through</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">blink</span><span style="color: #00AA00;">;</span></pre>
</td>
</tr>
</table>
</div>
<h5>预览</h5>
<ol style="background: #f5f5f5; padding: 20px 0px 20px 30px; border: 1px solid #ddd;">
<li style="">text-decoration设置为normal</li>
<li style="text-decoration: underline;">text-decoration设置为underline</li>
<li style="text-decoration: overline;">text-decoration设置为overline</li>
<li style="text-decoration: line-through;">text-decoration设置为line-through</li>
<li style="text-decoration: blink;">text-decoration设置为blink (只有Firefox 和Opera 支持)</li>
</ol>
<h3>Font-Variant</h3>
<p>font-variant属性允许你制作小型大写字母效果，也就是将小写字母变成大写并减小字体型号</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">font-variant</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-variant</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">small-caps</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-variant</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span></pre>
</td>
</tr>
</table>
</div>
<h5>预览</h5>
<ol style="background: #f5f5f5; padding: 20px 0px 20px 30px; border: 1px solid #ddd;">
<li style="font-variant: normal;">Font Variant 设置为 normal</li>
<li style="font-variant: small-caps;">Font Variant 设置为 small-caps</li>
<li style="font-variant: inherit;">Font variant 设置为 inherit</li>
</ol>
<h3>Letter-Spacing 和 word-spacing</h3>
<p>这两个属性都用来添加他们对应的元素中的空白。letter-spacing添加字母之间的空白，而word-spacing添加每个单词之间的空白。请注意，word-spacing对中文无效。</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span></pre>
</td>
</tr>
</table>
</div>
<h5>预览</h5>
<ol style="background: #f5f5f5; padding: 20px 0px 20px 30px; border: 1px solid #ddd;">
<li style="letter-spacing: normal;">Letter spacing 设置为 normal</li>
<li style="letter-spacing:2px;">Letter spacing 设置为 2px</li>
<li style="letter-spacing: inherit;">Letter spacing设置为 inherit</li>
</ol>
<h3>font缩写</h3>
<p>上面的font属性可以缩写，这样可以大大的提高你的css的效率。</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">font</span><span style="color: #3333ff;">:<span style="color: #000000; font-weight: bold;">font-style</span> </span>font-variant <span style="color: #000000; font-weight: bold;">font-weight</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">&#91;</span>/<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">&#93;</span> <span style="color: #000000; font-weight: bold;">font-family</span></pre>
</td>
</tr>
</table>
</div>
<p>请注意上面的缩写的书写顺序。另外，如果这里不设置line-height，元素的line-height将会被设置为默认的1，而不会从父级元素或body元素继承。使用缩写的时候，font-size和font-family是必须的，其它几项可根据情况不写。</p>
<h2>制作有吸引力的段落</h2>
<p>对于更有吸引力的段落排版，可以采用Robert Bringhurst的方法，它约定：用你的文字大小乘以30就可以得到段落的宽度。</p>
<p>比如如果你的文字大小是12px，用30乘以它，也就是360px，这样每行大约可以呈现65个英文字符。</p>
<h4>不正确的段落大小：</h4>
<p style="font-size: 12px; width: 200px; margin-top: 5px;"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining  essentially unchanged.</p>
<h4>正确的段落大小</h4>
<p style="font-size: 12px; width: 400px; margin-top: 5px;"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>
<h3>Line-height示例</h3>
<p>行高用来限定每行文字之间的空白大小。一个经验之谈就是让行高比你的字体大6-7px。</p>
<p>比如，如果你的文字大小是12px，加上6px就是你的行高，也就是18px。</p>
<h4>不正确的Line-Height</h4>
<p style="font-size: 12px; width: 400px; margin-top: 5px; line-height: 12px;"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>
<h4>正确的Line-Height</h4>
<p style="font-size: 12px; width: 400px; margin-top: 5px; line-height: 18px;"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>
<p>PS:关于line-height的设置，推荐一下码头写的《<a href="http://www.css88.com/archives/1311" target="_blank">line-height的继承问题</a>》</p>
<h2>清晰的强调文字</h2>
<style type="text/css"> 
em{ font-style:italic}
#demo5{ width:400px;}
#demo5:first-letter{ font-size:32px; color:#000}
#demo5:first-line{color:red;}
</style>
<p>下划线应该只用于文字链接，而斜体是一个更清晰的可选方案.</p>
<h4>不正确的例子</h4>
<p style="font-size: 12px; width: 400px; margin-top: 5px;"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an <strong>unknown printer</strong> took a galley of type and scrambled it to make a type specimen book. It has survived not only <strong>five centuries</strong>, but also the leap into <strong>electronic typesetting</strong>, remaining essentially unchanged.</p>
<h4>正确的例子</h4>
<p style="font-size: 12px; width: 400px; margin-top: 5px;"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an <em>unknown printer</em> took a galley of type and scrambled it to make a type specimen book. It has survived not only <em>five centuries</em>, but also the leap into <em>electronic typesetting</em>, remaining essentially unchanged.</p>
<h3>first-letter与first-line</h3>
<p>顾名思义，first-letter就是第一个字母，first-line是第一行文字，它们是少有的被所有主流浏览器支持的CSS 2.1 伪元素，你可以为它们定义任意样式。</p>
<h5>示例代码</h5>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#demo5</span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#demo5</span><span style="color: #3333ff;">:first-letter</span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">32px</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span><span style="color: #993333;">green</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#demo5</span><span style="color: #3333ff;">:first-line</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #993333;">red</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre>
</td>
</tr>
</table>
</div>
<div id="demo5">前端观察 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</div>
<h2>前瞻 – CSS3</h2>
<p>已经有一部分很棒的CSS3特性可以用到你的设计中了。当然这些中的一部分新属性还不能用于IE，但是你或许了解这对IE来说是常事儿，所以你不妨试试。</p>
<h2>@Font-face</h2>
<p><em>@font-face</em>允许你上次一个字体文件到你的网站服务器并将其引入到你的外部CSS文件中，然后就可以将它应用到你的网站的任何文字上。</p>
<p>这是处理文字的最大的功能，但是随之而来的是它的负面效果。由于版权问题，只有少数的字体“被允许”使用。这些字体也就是<a href="http://webfonts.info/wiki/index.php?title=Fonts_available_for_%40font-face_embedding" target="_blank">CSS3安全就在这里</a>里面提到的。当然，对于中文字体来说，除了版权问题，还有网速的问题，一般中文字体动辄几MB的大小，字体文件下载到浏览器就要几分钟，这对于用户来说是不划算的。</p>
<h3>使用@font-face</h3>
<p>在这个例子中我在我的网站的根目录下放了一个<em>font</em>文件夹，然后将需要用到的字体放入该文件夹。你首先需要声明@font-face 属性以导入你的字体文件，然后使用该字体名称来控制其它元素的字体。</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* 声明字体 */</span>
<span style="color: #a1a100;">@font-face {</span>
src<span style="color: #00AA00;">:</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">font/diavlo.otf</span><span style="color: #00AA00;">&#41;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* 将改字体应用到一个元素 */</span>
h1 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> diavlo<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre>
</td>
</tr>
</table>
</div>
<p>PS:关于页面的嵌入字体，推荐阅读《<a href="http://www.qianduan.net/how-to-use-personalized-fonts-in-web-design.html">如何在网页设计中使用个性化字体</a>》</p>
<h2>Text-Shadow</h2>
<p>text-shadow属性赶走了用Photoshop为某些元素制作下拉阴影的需求，并给你提供动态的阴影控制。当然，该属性IE并不支持。</p>
<p style="font-size: 2em; font-weight: bold; color: #777; text-shadow: 1px 1px 1px #222;text-indent:0">示例标题</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2em</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#777</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre>
</td>
</tr>
</table>
</div>
<p style="font-size: 2em; font-weight: bold; color:#777; text-shadow: 2px 2px 2px #222; margin-top: 20px;text-indent:0">示例标题2</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre>
</td>
</tr>
</table>
</div>
<p style="font-size: 2em; font-weight: bold; color: #fff; text-shadow: 1px 1px 5px #222; margin-top:20px; text-indent:0">示例标题3</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
</pre>
</td>
<td class="code">
<pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #933;">5px</span> <span style="color: #cc00cc;">#FFF</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre>
</td>
</tr>
</table>
</div>
<p>PS：呃，其实前端观察的文章标题和章节的二级标题都用了text-shadow，而且还是用了更漂亮的RGBa颜色。关于CSS阴影，强烈推荐阅读《<a href="http://www.qianduan.net/css-shadow-xiangjie.html">CSS阴影详解</a>》</p>
<h2>挑战</h2>
<p>本文中提到的这些技术都只是一个入门指南。试着采用并实现你喜欢的技术到你的设计中。排版可能是一个网站中最重要的部分，请不要无视它。</p>
<p>PS:本文在原文的基础上，补充了少量内容，比如first-letter和first-line部分——神飞</p>
<h4>关于原作者</h4>
<p><a href="http://www.threestyles.com/">Shane Jeffers</a>是<a href="http://www.threestyles.com/">Three Styles</a>的创办者和作者。他对设计趋势和教程有独特的喜好。你可以通过<a href="http://www.threestyles.com/contact">这个联系页面</a>和他联系到他或者在twitter上关注他 @<a href="http://www.twitter.com/threestyles">ThreeStyles</a> </p>
<p>译自：<a href="http://www.threestyles.com/tutorials/css-tips-for-better-typography/">The Ultimate Guide to CSS Typography</a><br />
中文：<a href="http://www.qianduan.net/ultimate-guide-css-text-typography.html">CSS文字排版终极指南</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/07/css-rgba/" title="CSS中的RGBa色彩">CSS中的RGBa色彩</a></li><li><a href="http://slj.me/2010/05/html5-new-features/" title="HTML5新功能演示">HTML5新功能演示</a></li><li><a href="http://slj.me/2010/04/%e7%94%a8css%e4%bf%ae%e6%ad%a3%e4%b8%80%e5%88%87%ef%bc%9a20%e5%a4%9a%e4%b8%aa%e5%b8%b8%e8%a7%81bug%e5%8f%8a%e5%85%b6%e4%bf%ae%e6%ad%a3%e6%96%b9%e6%b3%95/" title="用CSS修正一切：20多个常见Bug及其修正方法">用CSS修正一切：20多个常见Bug及其修正方法</a></li><li><a href="http://slj.me/2010/03/building-iphone-apps-with-html-css-and-javascript/" title="【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript">【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript</a></li><li><a href="http://slj.me/2009/12/tx-qzone-rounded-avatar-css/" title="研究腾讯Qzone圆角头像CSS有感">研究腾讯Qzone圆角头像CSS有感</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/ultimate-guide-css-text-typography/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zen Coding资源更新</title>
		<link>http://slj.me/2010/03/zen-coding%e8%b5%84%e6%ba%90%e6%9b%b4%e6%96%b0/</link>
		<comments>http://slj.me/2010/03/zen-coding%e8%b5%84%e6%ba%90%e6%9b%b4%e6%96%b0/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 06:38:11 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[zen coding]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1600</guid>
		<description><![CDATA[先前有介绍过一个超级快速写HTML代码的插件，专门发布了博文牛x无敌！！！Zen-Coding-一种快速编写htmlcss代码的方法 下面是是从前端复制过来的Zen Coding的资源链接 zen coding前些天升级到了0.6版本，新增了几项小功能，这里不再赘述，感兴趣的同学可以更新自己用的相应的插件； zen coding官方有个速查手册(PDF)，很全面，严重推荐； zen coding刚刚发布了 notepad++插件； 这里有个非官方的VIM插件：http://github.com/mattn/zencoding-vim (多谢 @kejunz 的分享) 使用UltraEdit的同学可以看一下 @ytzong写的《在UlrtraEdit中配置Zen Coding》教程； 使用EditPlus的同学可以看一下这个《zencoding(HTML) for EditPlus v1.0》 zen coding的dreamweaver插件安装教程http://www.qianduan.net/zen-coding-for-dreamweaver-plug-in-tutorial.html: Related Posts / 相关文章HTML5新功能演示【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript揭秘HTML5和CSS3转牛X无敌！！！Zen Coding: 一种快速编写HTML/CSS代码的方法【转】使用 Dojo 的 Ajax 应用开发进阶教程 : 富含语义的 HTML]]></description>
			<content:encoded><![CDATA[<p>先前有介绍过一个超级快速写HTML代码的插件，专门发布了博文<a href="http://slj.me/2009/12/%E7%89%9Bx%E6%97%A0%E6%95%8C%EF%BC%81%EF%BC%81%EF%BC%81zen-coding-%E4%B8%80%E7%A7%8D%E5%BF%AB%E9%80%9F%E7%BC%96%E5%86%99htmlcss%E4%BB%A3%E7%A0%81%E7%9A%84%E6%96%B9%E6%B3%95/">牛x无敌！！！Zen-Coding-一种快速编写htmlcss代码的方法</a></p>
<p>下面是是从前端复制过来的Zen Coding的资源链接</p>
<ol>
<li>zen coding前些天升级到了0.6版本，新增了几项小功能，这里不再赘述，感兴趣的同学可以更新自己用的相应的插件；</li>
<li style="color:red">zen coding官方有个<a href="http://zen-coding.googlecode.com/files/ZenCodingCheatSheet.pdf" target="_blank">速查手册</a>(PDF)，很全面，严重推荐；</li>
<li>zen coding刚刚发布了<a href="http://zen-coding.googlecode.com/files/Zen.Coding-Notepad%2B%2B.v0.6.zip" target="_blank"> notepad++插件</a>；</li>
<li>这里有个<strong>非官方</strong>的VIM插件：<a href="http://github.com/mattn/zencoding-vim">http://github.com/mattn/zencoding-vim</a> (多谢 @<a href="http://www.twitter.com/kejunz" target="_blank">kejunz</a> 的分享)</li>
<li>使用UltraEdit的同学可以看一下 @<a href="http://twitter.com/ytzong" target="_blank">ytzong</a>写的《<a href="http://www.99css.com/?p=253" target="_blank">在UlrtraEdit中配置Zen Coding</a>》教程；</li>
<li>使用EditPlus的同学可以看一下这个《<a href="http://www.vfresh.org/w3c/667">zencoding(HTML)  for EditPlus v1.0</a>》</li>
<li style="color:red">zen coding的dreamweaver插件安装教程<a href="http://www.qianduan.net/zen-coding-for-dreamweaver-plug-in-tutorial.html">http://www.qianduan.net/zen-coding-for-dreamweaver-plug-in-tutorial.html</a>:</li>
</ol>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/05/html5-new-features/" title="HTML5新功能演示">HTML5新功能演示</a></li><li><a href="http://slj.me/2010/03/building-iphone-apps-with-html-css-and-javascript/" title="【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript">【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript</a></li><li><a href="http://slj.me/2009/12/html5-css3/" title="揭秘HTML5和CSS3">揭秘HTML5和CSS3</a></li><li><a href="http://slj.me/2009/12/%e7%89%9bx%e6%97%a0%e6%95%8c%ef%bc%81%ef%bc%81%ef%bc%81zen-coding-%e4%b8%80%e7%a7%8d%e5%bf%ab%e9%80%9f%e7%bc%96%e5%86%99htmlcss%e4%bb%a3%e7%a0%81%e7%9a%84%e6%96%b9%e6%b3%95/" title="转牛X无敌！！！Zen Coding: 一种快速编写HTML/CSS代码的方法">转牛X无敌！！！Zen Coding: 一种快速编写HTML/CSS代码的方法</a></li><li><a href="http://slj.me/2009/07/dojo-ajax-semanticize-html/" title="【转】使用 Dojo 的 Ajax 应用开发进阶教程 : 富含语义的 HTML">【转】使用 Dojo 的 Ajax 应用开发进阶教程 : 富含语义的 HTML</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/zen-coding%e8%b5%84%e6%ba%90%e6%9b%b4%e6%96%b0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3, Please! The Cross-Browser CSS3 Rule Generator</title>
		<link>http://slj.me/2010/03/css3-please-the-cross-browser-css3-rule-generator/</link>
		<comments>http://slj.me/2010/03/css3-please-the-cross-browser-css3-rule-generator/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 06:33:32 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1598</guid>
		<description><![CDATA[CSS3 Please一个在线生成跨浏览器的CSS3代码的网站，现在支持的CSS 3属性有圆角、阴影、渐变、自定义字体、旋转、rgba色彩。 点击属性值直接修改就可以及时预览。toggle rule on和toggle rule off按钮可以启用或禁用某个属性。 事实上，现在支持这些CSS3属性的浏览器大都没有完全的支持W3C标准属性，而是采用自己的私有属性，这显然增加了开发的复杂度，也给将来的维护带来一些不确定性。不过貌似chrome dev版开始支持原生的border-radius了。 点击进入：http://css3please.com/ Related Posts / 相关文章关于几种文本替换技术－CSS3, sIFR, Typeface.js, cufon揭秘HTML5和CSS3来用实用的CSS3来制作你的酷炫按钮吧CSS 3 &#8211; 前途一片光明]]></description>
			<content:encoded><![CDATA[<p>CSS3  Please一个在线生成跨浏览器的CSS3代码的网站，现在支持的CSS  3属性有圆角、阴影、渐变、自定义字体、旋转、rgba色彩。</p>
<p>点击属性值直接修改就可以及时预览。toggle rule on和toggle rule off按钮可以启用或禁用某个属性。</p>
<p>事实上，现在支持这些CSS3属性的浏览器大都没有完全的支持W3C标准属性，而是采用自己的私有属性，这显然增加了开发的复杂度，也给将来的维护带来一些不确定性。不过貌似chrome dev版开始支持原生的border-radius了。</p>
<p>点击进入：<a href="http://css3please.com/">http://css3please.com/</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/07/font-replacement-css3-sifr-typeface-js-cufon/" title="关于几种文本替换技术－CSS3, sIFR, Typeface.js, cufon">关于几种文本替换技术－CSS3, sIFR, Typeface.js, cufon</a></li><li><a href="http://slj.me/2009/12/html5-css3/" title="揭秘HTML5和CSS3">揭秘HTML5和CSS3</a></li><li><a href="http://slj.me/2009/12/pushing-your-buttons-with-practical-css3/" title="来用实用的CSS3来制作你的酷炫按钮吧">来用实用的CSS3来制作你的酷炫按钮吧</a></li><li><a href="http://slj.me/2009/04/css-3-the-future-shines-bright/" title="CSS 3 &#8211; 前途一片光明">CSS 3 &#8211; 前途一片光明</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/css3-please-the-cross-browser-css3-rule-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【好书PDF】：Building iPhone Apps with HTML, CSS, and JavaScript</title>
		<link>http://slj.me/2010/03/building-iphone-apps-with-html-css-and-javascript/</link>
		<comments>http://slj.me/2010/03/building-iphone-apps-with-html-css-and-javascript/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 13:13:40 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[iPhone/Android]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1524</guid>
		<description><![CDATA[出版商: Oreilly &#124; ISBN: 0596805780 &#124; 2010年1月  &#124; PDF &#124; 192页 &#124; 2.8 Mb It’s a fact: if you know HTML, CSS, and JavaScript, you already have the tools you need to develop your own iPhone apps. With this book, you’ll learn how to use these open source web technologies to design and build apps [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://api.photoshop.com/home_8bb0df3698f64d62b5ee0a0a29be8bd1/adobe-px-assets/a066bab4ab804921937ffbe2fa980087" border="0" alt="点击查看下载大图-QuanPC.com全品网" width="320" height="480" /></p>
<p>出版商: Oreilly | ISBN: 0596805780 | 2010年1月  | PDF | 192页 | 2.8 Mb</p>
<p>It’s a fact: if you know HTML, CSS, and JavaScript, you already have the tools you need to develop your own iPhone apps. With this book, you’ll learn how to use these open source web technologies to design and build apps for the iPhone and iPod Touch on the platform of your choice-without using Objective-C or Cocoa.</p>
<p><span id="more-1524"></span>Device-agnostic mobile apps are the wave of the future, and this book shows you how to create one product for several platforms. You’ll find guidelines for converting your product into a native iPhone app using the free PhoneGap framework. And you’ll learn why releasing your product as a web app first helps you find, fix, and test bugs much faster than if you went straight to the App Store with a product built with Apple’s tools.</p>
<p>* Build iPhone apps with tools you already know how to use<br />
* Learn how to make an existing website look and behave like an iPhone app<br />
* Add native-looking animations to your web app using jQTouch<br />
* Take advantage of client-side data storage with apps that run even when the iPhone is offline<br />
* Hook into advanced iPhone features — including the accelerometer, geolocation, and vibration — with JavaScript<br />
* Submit your applications to the App Store with Xcode</p>
<p>PDF下载：</p>
<p><a href="http://rs773.rapidshare.com/files/342236383/Oreilly.Building.iPhone.Apps.with.HTML.CSS.and.JavaScript.Jan.2010.rar" target="_blank">Oreilly.Building.iPhone.Apps.with.HTML.CSS.and.JavaScript.Jan.2010.rar</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/05/html5-new-features/" title="HTML5新功能演示">HTML5新功能演示</a></li><li><a href="http://slj.me/2009/12/html5-css3/" title="揭秘HTML5和CSS3">揭秘HTML5和CSS3</a></li><li><a href="http://slj.me/2009/12/%e7%89%9bx%e6%97%a0%e6%95%8c%ef%bc%81%ef%bc%81%ef%bc%81zen-coding-%e4%b8%80%e7%a7%8d%e5%bf%ab%e9%80%9f%e7%bc%96%e5%86%99htmlcss%e4%bb%a3%e7%a0%81%e7%9a%84%e6%96%b9%e6%b3%95/" title="转牛X无敌！！！Zen Coding: 一种快速编写HTML/CSS代码的方法">转牛X无敌！！！Zen Coding: 一种快速编写HTML/CSS代码的方法</a></li><li><a href="http://slj.me/2009/04/dreamweaver-jquery-code-association/" title="在Dreamweaver中加入jQuery代码编写联想提示">在Dreamweaver中加入jQuery代码编写联想提示</a></li><li><a href="http://slj.me/2009/03/browser_css_hack_ie_ff/" title="关于一些浏览器的的Hack">关于一些浏览器的的Hack</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/building-iphone-apps-with-html-css-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>几款IE的调试工具</title>
		<link>http://slj.me/2010/03/ie-debug-tool/</link>
		<comments>http://slj.me/2010/03/ie-debug-tool/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 06:43:19 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1520</guid>
		<description><![CDATA[今天MeePlace被报了IE7的BUG，郁闷！ 介绍几个IE下的调试工具，需穿墙下载。 Companion.JS 这是一个IE下的JS调试工具，就像Firebug http://www.my-debugbar.com/wiki/CompanionJS/Installing DebugBar 这是IE的一个工具条，可以显示DOM，HTTP请求等 http://www.debugbar.com/ IETester 多窗口，多版本的IE http://www.my-debugbar.com/wiki/IETester/HomePage 还是那一句：I hate IE !!! Related Posts / 相关文章Xdebug for php 一个实用的PHP调试扩展“点亮网页”：一个实用的Firefox和IE插件CSS在Internet Explorer 6, 7 和8中的差别CSS半透明度设置归纳总结[Firefox,IE,Chrome,Safari]关于一些浏览器的的Hack]]></description>
			<content:encoded><![CDATA[<p>今天MeePlace被报了IE7的BUG，郁闷！</p>
<p>介绍几个IE下的调试工具，需穿墙下载。<br />
Companion.JS 这是一个IE下的JS调试工具，就像Firebug</p>
<p>http://www.my-debugbar.com/wiki/CompanionJS/Installing</p>
<p>DebugBar 这是IE的一个工具条，可以显示DOM，HTTP请求等</p>
<p>http://www.debugbar.com/</p>
<p>IETester 多窗口，多版本的IE</p>
<p>http://www.my-debugbar.com/wiki/IETester/HomePage</p>
<p>还是那一句：I hate IE !!!</p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2011/04/xdebug-for-php/" title="Xdebug for php 一个实用的PHP调试扩展">Xdebug for php 一个实用的PHP调试扩展</a></li><li><a href="http://slj.me/2010/03/light-web-useful-firefox-ie-plugin/" title="“点亮网页”：一个实用的Firefox和IE插件">“点亮网页”：一个实用的Firefox和IE插件</a></li><li><a href="http://slj.me/2009/10/css-differences-in-internet-explorer-6-7-and-8/" title="CSS在Internet Explorer 6, 7 和8中的差别">CSS在Internet Explorer 6, 7 和8中的差别</a></li><li><a href="http://slj.me/2009/04/css-alpha-opacity-setting-for-firefox-ie-chrome-safari/" title="CSS半透明度设置归纳总结[Firefox,IE,Chrome,Safari]">CSS半透明度设置归纳总结[Firefox,IE,Chrome,Safari]</a></li><li><a href="http://slj.me/2009/03/browser_css_hack_ie_ff/" title="关于一些浏览器的的Hack">关于一些浏览器的的Hack</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/ie-debug-tool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>为网页开发者准备的13个Google Chrome浏览器扩展</title>
		<link>http://slj.me/2010/03/13-google-chrome-plugin/</link>
		<comments>http://slj.me/2010/03/13-google-chrome-plugin/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 07:40:42 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1514</guid>
		<description><![CDATA[Google Chrome浏览器跟火狐浏览器一 样，可以通过使用扩展来增强浏览器的功能。如果你是一位网页开发 者，Google Chrome内置的开发者工具会让你的工作轻松不少。但是除此之外，Chrome浏览器上也有众多扩展给你提供不少工具，供你使用。扩展有一个最大好处， 那就是它可以让你不用切换到其他应用程序就可以完成一些任务。这种不用切换就能完成某些任务的特性可以让你节省不少时间。 注意：如果你在下载Chrome扩展时遇到问题，请打开C:Windows\System32\drivers\etc下的host文件，在其中添加一行：74.125.47.139 clients2.google.com 即可。 下 面就是13个你会觉得有用的Chrome浏览器扩展。 拾色器 拾色器可以让你获取任何颜色的Hex和RGB值！你也可以调整 颜色的色调，饱和度和颜色平衡。 Firebug精简版 Firebug精简版是针对开发的一款工具，它可以让你编辑，调试和监视网页页面的CSS，HTML，以及JavaScript内容。 域名注册查看器 这款 扩展可以查看某个域名是否可以购买。如果你可以直接通过工具条查到信息，那你还有必要另外登录专门的页面去查看吗？ Aviary 截屏扩展 Aviary 截屏扩展可以让你对任何页面进行截图，并通过Aviary.com的网页应用直接在浏览器中对图片进行编辑。另外，它也提供便利方式帮助你访问 Aviary 的网站和上面的工具 Lorem Ipsum测试文本生成器 Lorem Ipsum测试文本生成器不费吹灰之力就可以生成设计模型所需要的测试文本内容。 IE标签页 它会使用IE浏览器在Chrome的标签页中显示对应的页面。一些网站只能使用IE浏览器来访 问，有了这款扩展，你可以在Chrome中直接查看这些网站。对于那些想测试IE渲软引擎或是登录的网站需要使用ActiveX插件，或是想使用浏览器查 看本地文件的人来说，这款扩展会非常适合。 MeasureIt! MeasureIt! 可以让你画出一个尺子，然后测量网页页面中任一元素的高度和宽度。 PlainClothes 这款扩展会对页面进行样式渲软，设想一下：文本是黑色的，背景是白色的，未点击链接是蓝色的，访问过的链接 是紫色的，所有的链接都有下划线。或者你把这一切改成你想要的颜色。所有的文本都以你选择的默认字体来显示（这跟通过 “选项” &#62; “高级选项” &#62; “更改字体和语言设置”进行修改的效果是一样的）。修改后的效果会自动应用到所有页面。 滴管 滴管和颜色拾取扩展可以让你从页面或是从高级颜色拾取面板来选取颜色。 速度追踪器 速度追踪扩展可以帮助你识别并修正网页应用的性能问题。它会对从浏览器内部获得底层数据进行可以 可视化处理，并在你网页应用程序运行的过程中进行分析。速度追踪扩展是一款Chrome浏览器扩展，可以在扩展目前支持的所有平台上运行（window和 Linux）。 Pendule 它对Chrome内 置的开发者工具进行扩充。 分辨率测试 问辨率测试扩展可以改变浏览器的尺寸，方便开发者在不同的屏幕分辨率下预览网站的实际效果。它包含一个常用分辨率的列 [...]]]></description>
			<content:encoded><![CDATA[
<p>Google Chrome浏览器跟<a rel="external nofollow" href="http://webdesignledger.com/tools/ten-most-popular-firefox-plugins-of-web-designers">火狐浏览器</a>一 样，可以通过使用扩展来增强浏览器的功能。如果你是一位网页开发 者，Google Chrome内置的开发者工具会让你的工作轻松不少。但是除此之外，Chrome浏览器上也有众多扩展给你提供不少工具，供你使用。扩展有一个最大好处， 那就是它可以让你不用切换到其他应用程序就可以完成一些任务。这种不用切换就能完成某些任务的特性可以让你节省不少时间。</p>
<p><strong>注意：</strong>如果你在下载Chrome扩展时遇到问题，请打开C:Windows\System32\drivers\etc下的host文件，在其中添加一行：74.125.47.139   clients2.google.com 即可。</p>
<p>下 面就是<strong>13个你会觉得有用的Chrome浏览器扩展</strong>。<strong><br />
</strong></p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/egmjgagjcamhcilhinkipjdbfdmebmkd">拾色器</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/egmjgagjcamhcilhinkipjdbfdmebmkd"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_7.jpg" alt="google chrome extensions" /></a></p>
<p>拾色器可以让你获取任何颜色的Hex和RGB值！你也可以调整 颜色的色调，饱和度和颜色平衡。<br />
<span id="more-1514"></span></p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/bnbbfjbeaefgipfjpdabmpadaacmafkj">Firebug精简版</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/bnbbfjbeaefgipfjpdabmpadaacmafkj"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_1.jpg" alt="google chrome extensions" /></a></p>
<p>Firebug精简版是针对开发的一款工具，它可以让你编辑，调试和监视网页页面的CSS，HTML，以及JavaScript内容。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/pokekecininnhejfkgcbnekjddnepope">域名注册查看器</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/pokekecininnhejfkgcbnekjddnepope"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_11.jpg" alt="google chrome extensions" /></a></p>
<p>这款 扩展可以查看某个域名是否可以购买。如果你可以直接通过工具条查到信息，那你还有必要另外登录专门的页面去查看吗？</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/ncgcgghbabbopfcpgcjpfffdgnbadegf">Aviary 截屏扩展</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/ncgcgghbabbopfcpgcjpfffdgnbadegf"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_2.jpg" alt="google chrome extensions" /></a></p>
<p>Aviary 截屏扩展可以让你对任何页面进行截图，并通过Aviary.com的网页应用直接在浏览器中对图片进行编辑。另外，它也提供便利方式帮助你访问 Aviary 的网站和上面的工具</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/dmpfoncmmihgkooacnplecaopcefceam">Lorem Ipsum测试文本生成器</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/dmpfoncmmihgkooacnplecaopcefceam"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_3.jpg" alt="google chrome extensions" /></a></p>
<p>Lorem Ipsum测试文本生成器不费吹灰之力就可以生成设计模型所需要的测试文本内容。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/hehijbfgiekmjfkfjpbkbammjbdenadd">IE标签页</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/hehijbfgiekmjfkfjpbkbammjbdenadd"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_4.jpg" alt="google chrome extensions" /></a></p>
<p>它会使用IE浏览器在Chrome的标签页中显示对应的页面。一些网站只能使用IE浏览器来访 问，有了这款扩展，你可以在Chrome中直接查看这些网站。对于那些想测试IE渲软引擎或是登录的网站需要使用ActiveX插件，或是想使用浏览器查 看本地文件的人来说，这款扩展会非常适合。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/aonjhmdcgbgikgjapjckfkefpphjpgma">MeasureIt!</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/aonjhmdcgbgikgjapjckfkefpphjpgma"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_5.jpg" alt="google chrome extensions" /></a></p>
<p>MeasureIt! 可以让你画出一个尺子，然后测量网页页面中任一元素的高度和宽度。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/kleiknekfnnaaibjhlamidabhmckbddc">PlainClothes</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/kleiknekfnnaaibjhlamidabhmckbddc"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_6.jpg" alt="google chrome extensions" /></a></p>
<p>这款扩展会对页面进行样式渲软，设想一下：文本是黑色的，背景是白色的，未点击链接是蓝色的，访问过的链接 是紫色的，所有的链接都有下划线。或者你把这一切改成你想要的颜色。所有的文本都以你选择的默认字体来显示（这跟通过 “选项” &gt; “高级选项” &gt; “更改字体和语言设置”进行修改的效果是一样的）。修改后的效果会自动应用到所有页面。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/hmdcmlfkchdmnmnmheododdhjedfccka">滴管</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/hmdcmlfkchdmnmnmheododdhjedfccka"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_8.jpg" alt="google chrome extensions" /></a></p>
<p>滴管和颜色拾取扩展可以让你从页面或是从高级颜色拾取面板来选取颜色。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/ognampngfcbddbfemdapefohjiobgbdl">速度追踪器</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/ognampngfcbddbfemdapefohjiobgbdl"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_9.jpg" alt="google chrome extensions" /></a></p>
<p>速度追踪扩展可以帮助你识别并修正网页应用的性能问题。它会对从浏览器内部获得底层数据进行可以 可视化处理，并在你网页应用程序运行的过程中进行分析。速度追踪扩展是一款Chrome浏览器扩展，可以在扩展目前支持的所有平台上运行（window和 Linux）。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/gbkffbkamcejhkcaocmkdeiiccpmjfdi">Pendule</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/gbkffbkamcejhkcaocmkdeiiccpmjfdi"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_10.jpg" alt="google chrome extensions" /></a></p>
<p>它对Chrome内 置的开发者工具进行扩充。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/idhfcdbheobinplaamokffboaccidbal">分辨率测试</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/idhfcdbheobinplaamokffboaccidbal"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_12.jpg" alt="google chrome extensions" /></a></p>
<p>问辨率测试扩展可以改变浏览器的尺寸，方便开发者在不同的屏幕分辨率下预览网站的实际效果。它包含一个常用分辨率的列 表，另外你也可以输入你自己需要的分辨率。</p>
<h3><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/maabelkjnhafpphacjecmcnkkmjndjgl">Snippy</a></h3>
<p><a rel="external nofollow" href="https://chrome.google.com/extensions/detail/maabelkjnhafpphacjecmcnkkmjndjgl"><img src="http://webdesignledger.com/wp-content/uploads/2010/02/chrome_extensions_13.jpg" alt="google chrome extensions" /></a></p>
<p>Snippy可以让你让你抓取页面中的部分内容，然后保存下来， 供将来只用，它可以抓取丰富的内容，并保留格式。所以你用它来抓取段落。图片，链接等诸多格式的内容。</p>
<p><strong>来源：</strong> webdesignledger | <strong>作者：</strong>Henry Jones | <strong>译者：</strong><a rel="external nofollow" href="#">neodreamer</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/03/light-web-useful-firefox-ie-plugin/" title="“点亮网页”：一个实用的Firefox和IE插件">“点亮网页”：一个实用的Firefox和IE插件</a></li><li><a href="http://slj.me/2009/04/css-alpha-opacity-setting-for-firefox-ie-chrome-safari/" title="CSS半透明度设置归纳总结[Firefox,IE,Chrome,Safari]">CSS半透明度设置归纳总结[Firefox,IE,Chrome,Safari]</a></li><li><a href="http://slj.me/2009/04/jquery-rater-star-plugin/" title="jQuery Rater Star Plugin投票打星星插件">jQuery Rater Star Plugin投票打星星插件</a></li><li><a href="http://slj.me/2009/04/jcrop-the-jquery-image-cropping-plugin/" title="Jcrop-jQuery图片裁剪插件">Jcrop-jQuery图片裁剪插件</a></li><li><a href="http://slj.me/2009/03/30-wordpress-statistic-plugin/" title="30个Wordpress统计插件">30个Wordpress统计插件</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/13-google-chrome-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转] UED,UXD在中国</title>
		<link>http://slj.me/2010/03/%e8%bd%ac-ueduxd%e5%9c%a8%e4%b8%ad%e5%9b%bd/</link>
		<comments>http://slj.me/2010/03/%e8%bd%ac-ueduxd%e5%9c%a8%e4%b8%ad%e5%9b%bd/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 07:33:24 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[ued]]></category>
		<category><![CDATA[uxd]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1512</guid>
		<description><![CDATA[UED全称User Experience Design，中文叫“用户体验设计”。 UXD全称User eXperience Design，中文叫“用户体验设计”。 显然这两个词还是一回事情，但要比UE迟的多。最早我在2005年底从Yahoo那边了解的，大概2006年听到同行普遍提起，同年9月份“淘宝UED”团队博客建立之后，才被大家熟知。但中国互联网公司最早成立部门研究“用户体验”的不是淘宝，而是百度，当时就叫“用户体验部”，后来才被同化的UED。大概在2005年已经有30人左右成型的团队（用户体验部总监郭宇，于2004年11月加入百度）。 首先UED这个词来自海外，但在海外除Yahoo很少有公司提起。如前文所述，老外并不习惯叫UE，所以理论上描述“用户体验设计”的缩写不应该是UED，而是UXD。确实也有UXD的说法，但只偶尔在某些海外网站上见到，同行心目中的认知程度不高。 再仔细推敲，其实不难发现，UED这个词有误。因为“用户体验设计”的说法本身有问题，UE并不能通过Design完全解决，通常Design涉及的只是UE比较表层的Experience需求。事实上，海外公司普遍都叫“UX团队”，也没有“UED团队”的说法。 而UED来到中国后，反而成为主流论调，得到广大公司的认可。可见与UE类似，UED也具有很浓的本地化色彩。在进入用户体验执行层面之后，很多同行/公司的第一反应，是要有这样的一个人，或者有这样的一个团队。因此才有了“UE工程师、UE设计师”和“UED部门”类似的称谓。 早期UED部门设立的职能职位主要有用户研究、交互设计、视觉设计，慢慢后来加入前端开发、界面设计等，某些甚至把产品经理也划入其内。具体叫法五花八门、千奇百怪。有个重要差异值得探讨，关于“工程师、设计师”的区别，根据理论推敲，既然UE是个非理性话题，不似Usability那样有逻辑可以遵循，有标准可以执行，所以我认为偏重“感性”的用户体验应该更靠近“设计”。 当然，以现在的成熟观点来看，不管叫“UE设计师”还是“UE工程师”都是不合适的，因为本身用户体验设计就不应该是一个人或一个部门的工作，而良好用户体验是产品的全方位目标。从执行层面看，用“概念”来命名职位（如可用性工程师），明确职能（如产品部门、用户体验设计部门并存），都不利于团队协作，容易造成责权不分，具体我在2008年6月所写 用户体验的误解 中大概清晰了执行思路。 http://mashable.com/2009/01/09/user-experience-design/ User experience isn’t just the responsibility of a department or a person, That compartmentalist view of UX is evidence that it is not part of the organizational culture and hints to teams not having a common goal or vision for the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UED</strong>全称User Experience Design，中文叫“<strong>用户体验设计</strong>”。<br />
<strong>UXD</strong>全称User eXperience Design，中文叫“<strong>用户体验设计</strong>”。</p>
<p>显然这两个词还是一回事情，但要比UE迟的多。最早我在2005年底从Yahoo那边了解的，大概2006年听到同行普遍提起，同年9月份“淘宝UED”团队博客建立之后，才被大家熟知。但中国互联网公司最早成立部门研究“用户体验”的不是淘宝，而是百度，当时就叫“用户体验部”，后来才被同化的UED。大概在2005年已经有30人左右成型的团队（用户体验部总监郭宇，于2004年11月加入百度）。</p>
<p>首先UED这个词来自海外，但在海外除Yahoo很少有公司提起。如前文所述，老外并不习惯叫UE，所以理论上描述“用户体验设计”的缩写不应该是UED，而是UXD。确实也有UXD的说法，但只偶尔在某些海外网站上见到，同行心目中的认知程度不高。</p>
<p>再仔细推敲，其实不难发现，UED这个词有误。因为“用户体验设计”的说法本身有问题，UE并不能通过Design完全解决，通常Design涉及的只是UE比较表层的Experience需求。事实上，海外公司普遍都叫“UX团队”，也没有“UED团队”的说法。</p>
<p>而UED来到中国后，反而成为主流论调，得到广大公司的认可。可见与UE类似，UED也具有很浓的本地化色彩。在进入用户体验执行层面之后，很多同行/公司的第一反应，是要有这样的一个人，或者有这样的一个团队。因此才有了“UE工程师、UE设计师”和“UED部门”类似的称谓。</p>
<p>早期UED部门设立的职能职位主要有用户研究、交互设计、视觉设计，慢慢后来加入前端开发、界面设计等，某些甚至把产品经理也划入其内。具体叫法五花八门、千奇百怪。有个重要差异值得探讨，关于“工程师、设计师”的区别，根据理论推敲，既然UE是个非理性话题，不似Usability那样有逻辑可以遵循，有标准可以执行，所以我认为偏重“感性”的用户体验应该更靠近“设计”。<br />
<span id="more-1512"></span><br />
当然，以现在的成熟观点来看，不管叫“UE设计师”还是“UE工程师”都是不合适的，因为本身用户体验设计就不应该是一个人或一个部门的工作，而良好用户体验是产品的全方位目标。从执行层面看，用“概念”来命名职位（如可用性工程师），明确职能（如产品部门、用户体验设计部门并存），都不利于团队协作，容易造成责权不分，具体我在2008年6月所写 <a href="http://blog.rexsong.com/?p=1165" target="_blank">用户体验的误解</a> 中大概清晰了执行思路。</p>
<p><a href="http://mashable.com/2009/01/09/user-experience-design/" target="_blank">http://mashable.com/2009/01/09/user-experience-design/</a></p>
<blockquote><p><strong>User experience isn’t just the responsibility of a department or a person</strong>, That compartmentalist view of UX is evidence that it is not part of the organizational culture and hints to teams not having a common goal or vision for the experience they should deliver collectively.</p></blockquote>
<p>有趣的现象，几乎国内所有公司组建的“用户体验设计团队”都叫UED，并且已经形成固定用语，比如淘宝UED。只腾讯有个用户研究与体验设计中心(Customer Research &amp; User Experience Design Center)，简称叫CDC。</p>
<p>2008年之后，应该说业内UED发展达到高峰，互联网一线公司基本都组建了自己的UED团队。除淘宝外，阿里系公司先后还有阿里巴巴UED、阿里妈妈UED、阿里软件UED、支付宝UED、中国雅虎UED、口碑UED。业内其他还有百度UED、搜狐UED、网易UED、携程UED、金蝶友商网UED等等，都在互联网上有网站（绝大多数就是个blog）宣传和公关。大有成为互联网公司标准配置的趋势，从业者也以能进入这样的“专业团队”为荣。</p>
<p>我更倾向于腾讯CDC这样以专业研究机构名义的命名，如此更利于用户体验“理念”的推广，而不会造成部门之间的“隔绝”。事实也证明，成立“用户体验设计”部门走业务流程，自下而上推动产品质量提升的效果并不明显。容易给其他同事造成“做用户体验是那帮人的事”的错觉。</p>
<p>以大家喜闻乐见的Google为例子，2005年7月Google在中国设立研发中心，也相继设置了用户体验部门。与当时的百度一样，不叫UED，而且执行体系沿袭Google风格，基于产品而不是部门（注意此区别），一般由PM+Developer+Designer组合的小团队共同向产品负责，有时会有Researcher介入。产品组同事各有所长，展开平级协作，由整个团队来推动用户体验设计。</p>
<p>归根结底，体制决定一切。如今类似小团队跨部门的协作方式已被国内互联网公司积极学习，并且取得了良好效果。在执行框架内，如果UED脱离产品进行盲目细分，堕落成为用户研究+交互设计+视觉设计+前端开发，我认为将很不利于产品的创新、迭代、改进。</p>
<p>原文：<a href="http://blog.rexsong.com/?p=9436" target="_blank">UED,UXD在中国</a></p>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2009/04/2009-taobao-ued-recruit/" title="2009年淘宝UED团队招聘前端工程师">2009年淘宝UED团队招聘前端工程师</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/%e8%bd%ac-ueduxd%e5%9c%a8%e4%b8%ad%e5%9b%bd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[原创]多选/全选checkbox，AJAX提交。另附IE的onchange BUG</title>
		<link>http://slj.me/2010/03/multiple-selectable-checkbox-ajax-submit/</link>
		<comments>http://slj.me/2010/03/multiple-selectable-checkbox-ajax-submit/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 06:50:17 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[checkbox]]></category>
		<category><![CDATA[MeePlace]]></category>
		<category><![CDATA[onchange]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1501</guid>
		<description><![CDATA[最近在为MeePlace 2.7的后台编写多选功能。在一个接一个的版本中，MeePlace的后台是越来越强大了（不够谦虚，hoho），后台采用纯ajax异步（有的时候觉得编程会有点麻烦，但是从1.0开始就是这样的后台，现在要改的话也麻烦，况且AJAX能给用户带来更好的体验，就继续开发吧：D） 这次后台增加的功能中，有一个是能够多选/全选项目，这个已经是历史遗留问题了，在我所有开发的项目中都是用这套自己开发的后台系统，改一改就成。这次布莱恩吧multi-selectable列在了Milestone里，所以就写了。以前有做过多选，不过由于是原始form的post，所以比较简单。这次用AJAX的后台多选操作，我还是想了一下才开始动手的。 我的想法是，通过遍历checkbox，来得到有被选定了的checkbox的value，然后再传给后端进行多选处理。 下面公开MeePlace的这部分代码。 全选按钮。用户点击全选的那个checkbox后，checkbox的onclick=&#8221;select_item_all(this,&#8221;allitem&#8221;,&#8221;childitem&#8221;)&#8221; 其中&#8221;allitem&#8221;是全选的checkbox的classname，因为也许这个全选会出现两个，或者更多，比如表头和表尾各一。 &#8220;childitem&#8221;是所有的条目前的checkbox的classname。 JS代码： //全选按钮 function select_item_all(whochecked,allitem,childitem) { if(whochecked==true) { $('.'+allitem).attr('checked',true); $('.'+childitem).attr('checked',true); $('.itemtr').addClass('trselected'); } else { $('.'+allitem).attr('checked',false); $('.'+childitem).attr('checked',false); $('.itemtr').removeClass('trselected'); } } 这样通过判断提交全选的checkbox是否被勾选，来达到全选目的。 下面的代码是点击&#8221;Delete selected&#8221;（“删除所选”）之后，扫描所选中的checkbox的value以及发出警告和异步提交的代码 JS代码： function delselected(sheet,where,childitem) { //通过扫描制定childitem（项目前的checkbox的classname），来获取选中了的项目IDs var selected_ids=''; var obj=$("input:checked[class='"+childitem+"']"); $.each(obj, function(i,item){ selected_ids+= $(item).val() +','; }); if(selected_ids) { var a=confirm("CAUTION! You are going to delete a quantity [...]]]></description>
			<content:encoded><![CDATA[<p>    最近在为MeePlace 2.7的后台编写多选功能。在一个接一个的版本中，MeePlace的后台是越来越强大了（不够谦虚，hoho），后台采用纯ajax异步（有的时候觉得编程会有点麻烦，但是从1.0开始就是这样的后台，现在要改的话也麻烦，况且AJAX能给用户带来更好的体验，就继续开发吧：D）</p>
<p>这次后台增加的功能中，有一个是能够多选/全选项目，这个已经是历史遗留问题了，在我所有开发的项目中都是用这套自己开发的后台系统，改一改就成。这次布莱恩吧multi-selectable列在了Milestone里，所以就写了。以前有做过多选，不过由于是原始form的post，所以比较简单。这次用AJAX的后台多选操作，我还是想了一下才开始动手的。</p>
<p>我的想法是，通过遍历checkbox，来得到有被选定了的checkbox的value，然后再传给后端进行多选处理。</p>
<p>下面公开MeePlace的这部分代码。</p>
<p><img src="http://slj.me/wp-content/uploads/2010/03/meeplace-multi-check.png" alt="" title="meeplace-multi-check" width="430" height="270" class="alignnone size-full wp-image-1503" /></p>
<p>全选按钮。用户点击全选的那个checkbox后，checkbox的onclick=&#8221;select_item_all(this,&#8221;allitem&#8221;,&#8221;childitem&#8221;)&#8221;<br />
其中&#8221;allitem&#8221;是全选的checkbox的classname，因为也许这个全选会出现两个，或者更多，比如表头和表尾各一。<br />
&#8220;childitem&#8221;是所有的条目前的checkbox的classname。<br />
JS代码：<br />
<span id="more-1501"></span></p>
<pre name="code" class="js">
//全选按钮
function select_item_all(whochecked,allitem,childitem)
{
 if(whochecked==true)
 {
  $('.'+allitem).attr('checked',true);
  $('.'+childitem).attr('checked',true);
  $('.itemtr').addClass('trselected');
 }
 else
 {
  $('.'+allitem).attr('checked',false);
  $('.'+childitem).attr('checked',false);
  $('.itemtr').removeClass('trselected');
 }
}
</pre>
<p>这样通过判断提交全选的checkbox是否被勾选，来达到全选目的。</p>
<p>下面的代码是点击&#8221;Delete selected&#8221;（“删除所选”）之后，扫描所选中的checkbox的value以及发出警告和异步提交的代码<br />
JS代码：</p>
<pre name="code" class="js">
function delselected(sheet,where,childitem)
{
//通过扫描制定childitem（项目前的checkbox的classname），来获取选中了的项目IDs
   var selected_ids='';
   var obj=$("input:checked[class='"+childitem+"']");
    $.each(obj, function(i,item){
       selected_ids+= $(item).val() +',';
     });  

if(selected_ids)
{
 var a=confirm("CAUTION! You are going to delete a quantity of items.\n\rThese items will never be restored after deleted.\n\rSure to delete these items?");
if(a==0) return ;
}
else   //没有发现选中的checkbox
{
 alert('You have not selected any item.');
 return;
}

 //通过jQuery的$.post来异步提交数据
$.post("/mgt/func/delete.php?"+Math.random(), {
sheet:sheet,
where:where,
equal:selected_ids
},function(data){tips('Items deleted.');nav();});

}
</pre>
<p>对应 delete.php的代码，虽然代码不安全，能够直接注入的样子，直接操作数据库。但是出于是后台的代码，而且MeePlace对SESSION的检验非常严格，所以就这么用了，我想没有一个Admin想用自己的Admin权限黑自己的网站的。LOL<br />
PHP代码：</p>
<blockquote><p>//检查_SESSION</p>
<p>//自己的数据库连接，或者是框架的数据库接口</p>
<p>///传递过来的值，equals是所选ID经过explode()函数之后得出的数组<br />
$sheet=$_REQUEST[sheet]; //<br />
 $where=$_REQUEST[where]; //<br />
 $equal=$_REQUEST[equal]; // </p>
<p> $equals = explode(&#8220;,&#8221;, $equal);<br />
/// 循环删除数据库中的制定条目<br />
$i=0;<br />
while($i<count ($equals)) {<br />
	if($equals[$i]){<br />
		$query="delete from `$sheet` where `$where`= '$equals[$i]'  limit 1";<br />
		$rc=mysql_query("$query") or die("ERROR: $query");<br />
		$output.=$query."\n\r";<br />
	}<br />
	 $i++;<br />
}</p></blockquote>
<h3 style="color:red">另外如果你想通过checkbox的onchange来调用全选函数的话，结果是：IE不支持！最后只好使用onclick来实现了。这个也是历史遗留问题。算是IE的一个不愿解决的BUG</h3>
<p></count></p></blockquote>
<h2  class="related_post_title">Related Posts / 相关文章</h2><ul class="related_post"><li><a href="http://slj.me/2010/05/whats-new-for-meeplace-2-8/" title="What&#8217;s new for Meeplace 2.8">What&#8217;s new for Meeplace 2.8</a></li><li><a href="http://slj.me/2010/02/meeplace-2-6-release-feb-13-2010/" title="Meeplace 2.6 Release [Feb 13, 2010]">Meeplace 2.6 Release [Feb 13, 2010]</a></li><li><a href="http://slj.me/2010/01/%e4%bb%8a%e6%97%a5%e6%96%b0%e9%97%bb%ef%bc%9ameeplace-llc%e5%9c%a8%e5%8c%97%e7%be%8e%e6%b3%a8%e5%86%8c/" title="今日新闻：MeePlace LLC在北美注册">今日新闻：MeePlace LLC在北美注册</a></li><li><a href="http://slj.me/2010/01/%e5%85%b3%e4%ba%8emeeplace-2-4%e7%9a%84%e4%b8%ad%e6%96%87%e7%89%88%e8%af%b4%e6%98%8e/" title="我的近况与MeePlace 2.4说明">我的近况与MeePlace 2.4说明</a></li><li><a href="http://slj.me/2010/01/theme-upgrade-advice-for-meeplace-2-4/" title="Theme Upgrade Advice For MeePlace 2.4">Theme Upgrade Advice For MeePlace 2.4</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/03/multiple-selectable-checkbox-ajax-submit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iframe 父窗口和子窗口相互的调用方法集锦</title>
		<link>http://slj.me/2010/02/iframe-%e7%88%b6%e7%aa%97%e5%8f%a3%e5%92%8c%e5%ad%90%e7%aa%97%e5%8f%a3%e7%9b%b8%e4%ba%92%e7%9a%84%e8%b0%83%e7%94%a8%e6%96%b9%e6%b3%95%e9%9b%86%e9%94%a6/</link>
		<comments>http://slj.me/2010/02/iframe-%e7%88%b6%e7%aa%97%e5%8f%a3%e5%92%8c%e5%ad%90%e7%aa%97%e5%8f%a3%e7%9b%b8%e4%ba%92%e7%9a%84%e8%b0%83%e7%94%a8%e6%96%b9%e6%b3%95%e9%9b%86%e9%94%a6/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 04:53:48 +0000</pubDate>
		<dc:creator>SLJ</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[parent]]></category>

		<guid isPermaLink="false">http://slj.me/?p=1485</guid>
		<description><![CDATA[一、父窗口调用iframe子窗口方法 1、HTML语法：&#60;iframe name=&#8221;myFrame&#8221; src=&#8221;child.html&#8221;&#62;&#60;/iframe&#62; 2、父窗口调用子窗口：myFrame.window.functionName(); 3、子窗品调用父窗口：parent.functionName(); 简单地说,也就是在子窗口中调用的变量或函数前加个parent. 就行 4、父窗口页面源码： &#60;html&#62;    &#60;head&#62;    &#60;script   type=&#8221;text/javascript&#8221;&#62;    function say() {    alert(&#8220;parent.html&#8212;&#8212;&#62;I&#8217;m at parent.html&#8221;);    }  function callChild() {       //document.frames(&#8220;myFrame&#8221;).f1();    myFrame.window.say(); }    &#60;/script&#62;    &#60;/head&#62;         &#60;body&#62;      &#60;input   type=button   value=&#8221;调用child.html中的函数say()&#8221; onclick=&#8221;callChild()&#8221;&#62;  &#60;iframe name=&#8221;myFrame&#8221; src=&#8221;child.html&#8221;&#62;&#60;/iframe&#62;  &#60;/body&#62;    &#60;/html&#62;   5、子窗口页面： &#60;html&#62;    &#60;head&#62;    &#60;script type=&#8221;text/javascript&#8221;&#62;        function say()    {              alert(&#8220;child.html&#8212;&#62;I&#8217;m at child.html&#8221;);    }  function callParent() {    parent.say();    }  &#60;/script&#62;    &#60;/head&#62;    &#60;body&#62;    &#60;input   type=button   value=&#8221;调用parent.html中的say()函数&#8221;   onclick=&#8221;callParent()&#8221;&#62;    &#60;/body&#62;    &#60;/html&#62; 二、iframe 父窗口和子窗口相互的调用方法 1、IE中使用方法： 父窗口调用子窗口：iframe_ID.iframe_document_object.object_attribute = attribute_value 例子：onClick=&#8221;iframe_text.myH1.innerText=&#8217;http://www.pint.com&#8217;;&#8221; 子窗口调用父窗口：parent.parent_document_object.object_attribute = [...]]]></description>
			<content:encoded><![CDATA[<p><strong>一、父窗口调用iframe子窗口方法</strong></p>
<p>1、HTML语法：&lt;iframe name=&#8221;myFrame&#8221; src=&#8221;child.html&#8221;&gt;&lt;/iframe&gt;</p>
<p>2、父窗口调用子窗口：myFrame.window.functionName();</p>
<p>3、子窗品调用父窗口：parent.functionName();</p>
<p>简单地说,也就是在子窗口中调用的变量或函数前加个parent. 就行</p>
<p>4、父窗口页面源码：<br />
<span id="more-1485"></span></p>
<div>
<li>&lt;html&gt;   </li>
<li>&lt;head&gt;   </li>
<li>&lt;script   type=&#8221;text/javascript&#8221;&gt;   </li>
<li>function say() {</li>
<li>   alert(&#8220;parent.html&#8212;&#8212;&gt;I&#8217;m at parent.html&#8221;);</li>
<li>   } </li>
<li>function callChild()</li>
<li>{   </li>
<li>   //document.frames(&#8220;myFrame&#8221;).f1();</li>
<li>   myFrame.window.say();</li>
<li>}   </li>
<li>&lt;/script&gt;   </li>
<li>&lt;/head&gt;   </li>
<li>    </li>
<li>&lt;body&gt;     </li>
<li>&lt;input   type=button   value=&#8221;调用child.html中的函数say()&#8221; onclick=&#8221;callChild()&#8221;&gt; </li>
<li>&lt;iframe name=&#8221;myFrame&#8221; src=&#8221;child.html&#8221;&gt;&lt;/iframe&gt; </li>
<li>&lt;/body&gt;   </li>
<li>&lt;/html&gt;  </li>
</div>
<p>5、子窗口页面：<strong></strong></p>
<div>
<li>&lt;html&gt;   </li>
<li>&lt;head&gt;   </li>
<li>&lt;script type=&#8221;text/javascript&#8221;&gt;</li>
<li>      </li>
<li>function say()   </li>
<li>{   </li>
<li>          alert(&#8220;child.html&#8212;&gt;I&#8217;m at child.html&#8221;);   </li>
<li>} </li>
<li>function callParent() {</li>
<li>   parent.say();</li>
<li>   } </li>
<li>&lt;/script&gt;   </li>
<li>&lt;/head&gt;   </li>
<li>&lt;body&gt;   </li>
<li>&lt;input   type=button   value=&#8221;调用parent.html中的say()函数&#8221;   onclick=&#8221;callParent()&#8221;&gt;   </li>
<li>&lt;/body&gt;   </li>
<li>&lt;/html&gt;</li>
</div>
<p>二、iframe 父窗口和子窗口相互的调用方法</p>
<p><strong>1、IE中使用方法：</strong></p>
<p>父窗口调用子窗口：iframe_ID.iframe_document_object.object_attribute = attribute_value<br />
例子：onClick=&#8221;iframe_text.myH1.innerText=&#8217;http://www.pint.com&#8217;;&#8221;<br />
子窗口调用父窗口：parent.parent_document_object.object_attribute = attribute_value<br />
例子：onclick=&#8221;parent.myH1.innerText=&#8217;http://www.pint.com&#8217;;&#8221;</p>
<p><strong>2、Firefox中使用方法：</strong></p>
<p>上面在IE下没有问题，但在firefox下不正常。在firefox下，应该是如下调用方法：</p>
<p>父窗口调用子窗口：window.frames["iframe_ID"].document.getElementById(&#8220;iframe_document_object&#8221;­).object_attribute = attribute_value <br />
例： window.frames["iframe_text"].document.getElementById(&#8220;myH1&#8243;).innerHTML= &#8220;<a href="http://hi.wonsoft.cn/">http://hi.wonsoft.cn</a>&#8220;;<br />
子窗口调用父窗口：parent.document.getElementById(&#8220;parent_document_object&#8221;).object_attribute = attribute_value <br />
例： parent.document.getElementById(&#8220;myH1&#8243;).innerHTML = &#8220;<a href="http://wonsoft.cn/">http://wonsoft.cn</a>&#8220;;</p>
<p><strong>3、完整的例子<br />
</strong>test.htm</p>
<div>
<li>&lt;HTML&gt;</li>
<li>    &lt;HEAD&gt;</li>
<li>        &lt;TITLE&gt; Test Page &lt;/TITLE&gt;</li>
<li>        &lt;script src=&#8221;prototype-1.4.0.js&#8221;&gt;&lt;/script&gt;</li>
<li>        &lt;script language=&#8221;javascript&#8221;&gt;</li>
<li>            function show()</li>
<li>            {</li>
<li>                window.frames["iframe_text"].document.getElementById(&#8220;myH1&#8243;).innerHTML = &#8221;http://hi.wonsoft.cn&#8221;;</li>
<li>            }</li>
<li>        &lt;/script&gt; </li>
<li>    &lt;/HEAD&gt;</li>
<li>    &lt;BODY&gt;</li>
<li>        &lt;iframe height=&#8221;350&#8243;  width=&#8221;600&#8243; src=&#8221;iframe_test.htm&#8221; name=&#8221;iframe_text&#8221;&gt;&lt;/iframe&gt;</li>
<li>        &lt;form action=&#8221;" method=&#8221;post&#8221;&gt;</li>
<li>            &lt;input name=&#8221;haha&#8221; id=&#8221;haha&#8221; type=&#8221;text&#8221; maxlength=&#8221;30&#8243; value=&#8221;haha&#8221; /&gt;</li>
<li>            &lt;br /&gt;</li>
<li>            &lt;textarea cols=&#8221;50&#8243; rows=&#8221;5&#8243; id=&#8221;getAttributeMethod&#8221;&gt;&lt;/textarea&gt;</li>
<li>            &lt;input type=&#8221;button&#8221; onClick=&#8221;show();&#8221; value=&#8221;提交&#8221;/&gt;</li>
<li>        &lt;/form&gt;</li>
<li>        &lt;h1 id=&#8221;myH1&#8243;&gt;d&lt;/h1&gt;</li>
<li>    &lt;/BODY&gt;</li>
<li>&lt;/HTML&gt;</li>
</div>
<p> frame_test.htm</p>
<div>
<li>&lt;!DOCTYPE html PUBLIC &#8221;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8221;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;</li>
<li>&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;</li>
<li>  &lt;head&gt;</li>
<li>    &lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=gb2312&#8243; /&gt;</li>
<li>    &lt;title&gt;无标题文档&lt;/title&gt;</li>
<li>  &lt;/head&gt;</li>
<li>  &lt;script language=&#8221;javascript&#8221;&gt;</li>
<li>    function show()</li>
<li>    {</li>
<li>      parent.document.getElementById(&#8220;myH1&#8243;).innerHTML = <a href="http://wonsoft.cn/">http://wonsoft.cn</a>; </li>
<li>    }</li>
<li>  &lt;/script&gt;</li>
<li>  &lt;body&gt;</li>
<li>    &lt;h1 id=&#8221;myH1&#8243;&gt;ha&lt;/h1&gt;</li>
<li>    &lt;form action=&#8221;" method=&#8221;post&#8221;&gt;</li>
<li>      &lt;input name=&#8221;abc&#8221; id=&#8221;abc&#8221; type=&#8221;text&#8221; maxlength=&#8221;30&#8243; value=&#8221;abc&#8221; /&gt;</li>
<li>      &lt;br /&gt;</li>
<li>      &lt;textarea cols=&#8221;50&#8243; rows=&#8221;10&#8243; id=&#8221;text&#8221;&gt;&lt;/textarea&gt;</li>
<li>      &lt;br /&gt;</li>
<li>      &lt;input type=&#8221;button&#8221; value=&#8221;提交&#8221; onclick=&#8221;show();&#8221;/&gt;</li>
<li>    &lt;/form&gt;</li>
<li>  &lt;/body&gt;</li>
<li>&lt;/html&gt;</li>
</div>
<p>test.htm里面firefox下访问iframe 必须用name，不能用id，所以要改为name=&#8221;iframe_test&#8221; 。(<a href="http://chenling1018.blog.163.com/blog/static/1480254200811891041694/">http://chenling1018.blog.163.com/blog/static/1480254200811891041694/</a>)</p>
<p><strong>三、在c#中如何动态改变iframe的src值，动态指向一个网页</strong></p>
<p><strong>1)如果是javascript脚本</strong>  <br />
  给iframe加一个ID如&lt;iframe   id=frmList……  <br />
  在脚本写  <br />
  frmList.document.location=strNewUrl   </p>
<p><strong>2)如果是后台程序</strong>  <br />
  给iframe加一个ID，再加上runat=server   如&lt;iframe   id=frmList   runat=server   ……    <br />
  在程序里写  <br />
  frmList.Attributes.Add(&#8220;src&#8221;,strNewUrl);</p>
<h2  class="related_post_title">Other Posts / 其他文章</h2><ul class="related_post"><li><a href="http://slj.me/2009/12/tx-qzone-rounded-avatar-css/" title="研究腾讯Qzone圆角头像CSS有感">研究腾讯Qzone圆角头像CSS有感</a></li><li><a href="http://slj.me/2010/01/js%e8%8e%b7%e5%8f%96%e6%b5%8f%e8%a7%88%e5%99%a8%e7%aa%97%e5%8f%a3%e5%a4%a7%e5%b0%8f-%e8%8e%b7%e5%8f%96%e5%b1%8f%e5%b9%95%ef%bc%8c%e6%b5%8f%e8%a7%88%e5%99%a8%ef%bc%8c%e7%bd%91%e9%a1%b5%e9%ab%98/" title="JS获取浏览器窗口大小 获取屏幕，浏览器，网页高度宽度 ">JS获取浏览器窗口大小 获取屏幕，浏览器，网页高度宽度 </a></li><li><a href="http://slj.me/2009/12/lazyload/" title="LazyLoad &#8211; jQuery延迟载入插件">LazyLoad &#8211; jQuery延迟载入插件</a></li><li><a href="http://slj.me/2009/10/%e4%b8%ad%e6%96%87%e5%ad%97%e4%bd%93%e7%9a%84%e9%80%89%e6%8b%a9/" title="中文字体的选择">中文字体的选择</a></li><li><a href="http://slj.me/2010/12/centos-apache-firewall-settings/" title="CentOS 安装 Apache 后其他机器无法访问的解决方法">CentOS 安装 Apache 后其他机器无法访问的解决方法</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://slj.me/2010/02/iframe-%e7%88%b6%e7%aa%97%e5%8f%a3%e5%92%8c%e5%ad%90%e7%aa%97%e5%8f%a3%e7%9b%b8%e4%ba%92%e7%9a%84%e8%b0%83%e7%94%a8%e6%96%b9%e6%b3%95%e9%9b%86%e9%94%a6/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

