<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>耗子么</title>
	<atom:link href="http://haozi.me/feed" rel="self" type="application/rss+xml" />
	<link>http://haozi.me</link>
	<description>又一个 WordPress 站点</description>
	<lastBuildDate>Fri, 02 Sep 2011 11:23:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>前端开发人员必须熟悉的10个CSS3属性</title>
		<link>http://haozi.me/post/718.html</link>
		<comments>http://haozi.me/post/718.html#comments</comments>
		<pubDate>Fri, 02 Sep 2011 06:39:01 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://haozi.me/?p=718</guid>
		<description><![CDATA[随着Css3和html5的风靡，越来越多的前端人员开始学习Css3，今天的就来说说前端开发应该掌握的10个Css3属性。 对于Css3的新属性，你又了解多少呢？虽然大多数的css3属性在很多流行的浏览器中不支持，但是我们鼓励在前端开发中要学会并且运行这些css3属性，因为这是未来的趋势。 关键是首先确定你是否对各个浏览器之间的细微的差别有所了解，你能肯定的说IE显示的90度的角就不圆滑嘛？这取决于你的决定。但是要永远记住，网站设计不必看到所有浏览器的不同。 1. Border-radius Border-radius是一大堆CSS3属性中最受欢迎的一种，border-radius是CSS3中级别最高的一个属性。当设计者害怕一个层在将在不同的浏览器之间以不同的方式显示时，CSS圆角，一个很初级的知识，将引导他们开始学习。 我们为移动浏览器提供一个备用的观看体验的想法都非常好。奇怪的是，当这种方法出现在桌面浏览器上时，他们却又不这么认为。border-radius是一大堆CSS3属性中最受欢迎的一种，border-radius是CSS3中级别最高的一个属性。当设计者害怕一个层在将在不同的浏览器之间以不同的方式显示时，CSS圆角，一个很初级的知识，将引导他们开始学习。我们为移动浏览器提供一个备用的观看体验的想法都非常好。奇怪的是，当这种方法出现在桌面浏览器上时，他们却又不这么认为。 -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; 注意：请在Safari 5和IE9浏览器中执行“border-radius”语法。 圆 许多读者也许不会意识到我们可以用这个属性来做一个圆。 -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; 如果想再添加点效果，我们可以利用Flexible Box Model（详情在8中）来使得文字在垂直在水平方向都居中。这需要加点代码，但这仅仅是对不同浏览器的补偿。 display: -moz-box; display: -webkit-box; display: box; -moz-box-orient: horizontal; /* the default, so not really necessary here */ -webkit-box-orient: horizontal; box-orient: horizontal; -moz-box-pack: center; -moz-box-align: center; -webkit-box-pack: center; -webkit-box-align: center; [...]]]></description>
			<content:encoded><![CDATA[<p>随着Css3和html5的风靡，越来越多的前端人员开始学习Css3，今天的就来说说前端开发应该掌握的10个Css3属性。<br />
    对于Css3的新属性，你又了解多少呢？虽然大多数的css3属性在很多流行的浏览器中不支持，但是我们鼓励在前端开发中要学会并且运行这些css3属性，因为这是未来的趋势。<br />
    关键是首先确定你是否对各个浏览器之间的细微的差别有所了解，你能肯定的说IE显示的90度的角就不圆滑嘛？这取决于你的决定。但是要永远记住，网站设计不必看到所有浏览器的不同。<br />
    1. Border-radius<br />
    Border-radius是一大堆CSS3属性中最受欢迎的一种，border-radius是CSS3中级别最高的一个属性。当设计者害怕一个层在将在不同的浏览器之间以不同的方式显示时，CSS圆角，一个很初级的知识，将引导他们开始学习。 我们为移动浏览器提供一个备用的观看体验的想法都非常好。奇怪的是，当这种方法出现在桌面浏览器上时，他们却又不这么认为。border-radius是一大堆CSS3属性中最受欢迎的一种，border-radius是CSS3中级别最高的一个属性。当设计者害怕一个层在将在不同的浏览器之间以不同的方式显示时，CSS圆角，一个很初级的知识，将引导他们开始学习。我们为移动浏览器提供一个备用的观看体验的想法都非常好。奇怪的是，当这种方法出现在桌面浏览器上时，他们却又不这么认为。<br />
    -webkit-border-radius: 4px;<br />
    -moz-border-radius: 4px;<br />
    border-radius: 4px;<br />
    注意：请在Safari 5和IE9浏览器中执行“border-radius”语法。<br />
    圆<br />
    许多读者也许不会意识到我们可以用这个属性来做一个圆。<br />
    -moz-border-radius: 50px;<br />
    -webkit-border-radius: 50px;<br />
     border-radius: 50px;<br />
    如果想再添加点效果，我们可以利用Flexible Box Model（详情在8中）来使得文字在垂直在水平方向都居中。这需要加点代码，但这仅仅是对不同浏览器的补偿。<br />
    display: -moz-box;<br />
    display: -webkit-box;<br />
    display: box;<br />
    -moz-box-orient: horizontal; /* the default, so not really necessary here */<br />
    -webkit-box-orient: horizontal;<br />
    box-orient: horizontal;<br />
    -moz-box-pack: center;<br />
    -moz-box-align: center;<br />
    -webkit-box-pack: center;<br />
    -webkit-box-align: center;<br />
    box-pack: center;<br />
    box-align: center;<br />
    2. Box-shadow<br />
    接下来是非常普遍的Box-shadow，可以使你的元素立即美化，只是记得不要把值设得太离谱。<br />
    -webkit-box-shadow: 1px 1px 3px #292929;<br />
    -moz-box-shadow: 1px 1px 3px #292929;<br />
    box-shadow: 1px 1px 3px #292929;<br />
    box-shadow的四个参数<br />
    x-offset x轴偏移<br />
    y-offset y轴偏移<br />
    blur 模糊值<br />
    color of shadow 阴影颜色<br />
    现在，许多人不知道可以一次运用多个box-shadows，这样做会产生一些有趣的效果。在下图中，我使用蓝色和绿色阴影来放大一下效果。<br />
    Box-shadow<br />
    -webkit-box-shadow: 1px 1px 3px green, -1px -1px blue;<br />
    -moz-box-shadow: 1px 1px 3px green,-1px -1px blue;<br />
    box-shadow: 1px 1px 3px green, -1px -1px blue;<br />
    Clever Shadows</p>
<div>
       <img src="tuts.jpg" alt="Tuts" />
    </div>
<p>    The CSS<br />
    .box:after {<br />
       content: ”;<br />
       position: absolute;<br />
       z-index: -1; /* hide shadow behind image */<br />
       /* The Shadow */<br />
       -webkit-box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);<br />
       -moz-box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);<br />
       -box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);<br />
       width: 70%;<br />
       left: 15%; /* one half of the remaining 30% (see width above) */<br />
       height: 100px;<br />
       bottom:  0;<br />
    }<br />
 3. Text-shadow<br />
    Text-shadow是我们可以省略前缀的几个CSS属性之一，类似的还有box-shadow，它必须应用于文本，并它们有相同的四个参数：<br />
    x-offset 水平位移<br />
    y-offest 垂直位移<br />
    blur 模糊值<br />
    color of shadow 阴影颜色<br />
     h1 {<br />
        text-shadow: 0 1px 0 white;<br />
        color: #292929;<br />
     }<br />
    Text-Outline和box-shadow一样，它可以设置多个阴影通过逗号分隔符。例如，我们创建文本框的轮廓，当Webkit不支持stroke效果，我们可以使用下面的代码让更多的浏览器支持（虽然不是很美观）。<br />
    body { background: white; }<br />
    h1 {<br />
       text-shadow: 0 1px 0 black, 0 -1px 0 black, 1px 0 0 black, -1px 0 0 black;<br />
       color: white;<br />
    }<br />
    Text-Outline<br />
    4. Text-Stroke<br />
    使用这个方法时要注意了，只有Webkit（Safari， Chrome， iPhone）在最后的几年内还支持这个属性。其实，虽然我可能是错的，Text-stroke还不属于CSS3范畴的一部分。在这种情况下，使用白色字体时，Firefox会显示一个空白页面。要解决此问题，你即可以使用Javascript，也可以通过使用一种不同于背景颜色的文字颜色。<br />
    h1 {<br />
       -webkit-text-stroke: 3px black;<br />
       color: white;<br />
    }<br />
    Feature Detection我们如何为firefox提供一组可用的样式，和为另外的一组Safari或Chrome？解决办法就是多做测试。 通过feature detection，我们可以利用JavaScript来测试某属性是否可用，如果不行，我可 就要采用备用的。 再回到text-stroke的问题上，为不支持此属性的浏览器设定一个备用黑色（目前的除webkit外）。<br />
    var h1 = document.createElement(&#8216;h1&#8242;);<br />
    if ( !( &#8216;webkitTextStroke&#8217; in h1.style ) ) {<br />
       var heading = document.getElementsByTagName(&#8216;h1&#8242;)[0];<br />
       heading.style.color = &#8216;black&#8217;;<br />
    }<br />
    首先我们设定一个h1元素，然后执行，通过样式属性以确定-webkit-text-stroke是否支持此元素。如果不支持，我们会把标题由白色 设置成黑色。<br />
    5. Multiple Backgrounds<br />
    Multiple Backgrounds<br />
    Background属性在CSS3样式中已经彻底改革，开始支持多背景图片。 举个简单的例子，如果没和合适的图像，我们将使用两个教程的图像作为我们的背景，当然在程序中你可能会用纹理，也许是渐变作为图像。<br />
    .box {<br />
    background: url(image/path.jpg) 0 0 no-repeat,<br />
     url(image2/path.jpg) 100% 0 no-repeat;<br />
    }<br />
    以上，通过逗号分隔符，插入了两张背景图像，第一个的定位是（0，0），第二个的定位是（100%，0）。 要确定你对不支持的浏览器使用了备用图片，否则，它将跳此属性，使背景图像留空。 对旧浏览器的补偿要添加一张单独的图像给老浏览器用，像IE7。要定义两遍background，一遍是为老浏览器，另一遍是重写。或者你可以再次查看下 Modernizr。<br />
    .box {<br />
    /* fallback */<br />
    background: url(image/path.jpg) no-repeat;<br />
    /* modern browsers */<br />
    background: url(image/path.jpg) 0 0 no-repeat,<br />
     url(image2/path.jpg) 100% 0 no-repeat;<br />
    }<br />
    6. background-size<br />
    目前我们已经可以使用这种比较灵活的方式去重定义背景图像的大小。<br />
    background: url(path/to/image.jpg) no-repeat;<br />
    background-size: 100% 100%;<br />
    上面的代码使得背景图像已经占据了整个可用空间。但是，如果我们使用一个特殊的图片去占据body元素的整个空间而无论窗口有多宽，那又怎么做？<br />
    body, html { height: 100%; }<br />
    body {<br />
     background: url(path/to/image.jpg) no-repeat;<br />
     background-size: 100% 100%;<br />
    }<br />
    对，就是这么做，分别定义background-size的x，y参数。 最新版本的Chrome 和 Safari支持此属性，但我们还是要用旧的方法支持旧的浏览器。<br />
    body {<br />
     background: url(path/to/image.jpg) no-repeat;<br />
     -moz-background-size: 100% 100%;<br />
     -o-background-size: 100% 100%;<br />
     -webkit-background-size: 100% 100%;<br />
     background-size: 100% 100%;<br />
    }<br />
    7. text-overflow<br />
    浏览器最初开发文本溢出属性可以设定两个值：clip ellipsis 此属性支持切断容器中的文本，而且也给出了一个省略号的特性。<br />
    .box {<br />
       -o-text-overflow: ellipsis;<br />
       text-overflow:ellipsis;<br />
       overflow:hidden;<br />
       white-space:nowrap;<br />
       border: 1px solid black;<br />
       width: 400px;<br />
       padding: 20px;<br />
       cursor: pointer;<br />
    }<br />
    或许你会考虑当鼠标经过时显示全部的文本内容。<br />
    #box:hover {<br />
      white-space: normal;<br />
      color: rgba(0,0,0,1);<br />
      background: #e3e3e3;<br />
      border: 1px solid #666;<br />
    }<br />
    有点奇怪，这看起来并不像是重置text-overflow属性或是停用它，使之生效，在on:hover中我们可以使得white-space的 normal属性。现在正常了。 知道吗？您还可以指定自己的字符串，应使用省略号的位置。这样做来修饰要显示的文本字符串。<br />
    8. Flexible Box Model<br />
    Flexible Box Model将最终使我们远离类似float的困扰。虽然是要给你的头部换一个新的属性，但一旦你这么做了，将终身受益。 做个演示，创建简单的两列布局。</p>
<div id="container">
<div id="main"> Main content here </div>
<aside> Aside content here </aside>
</p></div>
<p>    首先我们要设定一个容器，然后指定它的宽和高，即便是没有实质性的内容在里面。<br />
    #container {<br />
        width: 960px;<br />
        height: 500px; /* just for demo */<br />
        background: #e3e3e3;<br />
        margin: auto;<br />
        display: -moz-box;<br />
        display: -webkit-box;<br />
        display: box;<br />
    接下来分别定义#main和aside的背景色<br />
    #main {<br />
       background: yellow;<br />
    }<br />
    aside {<br />
       background: red;<br />
    }<br />
    到目前为了还没有看出什么效果来。<br />
    值得一提的是，虽然我们设置了display:box模型，它的子元素会占据整个垂直空间。这就是它的默认box-align属性stretch。 看看有什么效果产生，当我们设置了#main的宽度后。<br />
    #main {<br />
      background: yellow;<br />
      width: 800px;<br />
    }<br />
    但是我们仍有个疑问，为什么aside不占据剩余的全部空间呢？我们可以用新属性box-flex来试下。 box-flex 使得元素占据整个空间。<br />
    aside {<br />
        display: block; /* cause is HTML5 element */<br />
        background: red;<br />
       /* take up all available space */<br />
        -moz-box-flex: 1;<br />
        -webkit-box-flex: 1;<br />
        box-flex: 1;<br />
     }<br />
    使用这个属性后，不管#main有多宽，aside都将占据整个可用的空间。同时你也不必担心诸如float等产生的问题，像使得元素被排挤到下一 行。<br />
    我只是在这儿肤浅的说一下，请参阅保罗爱尔兰优秀文章的详细信息。然而，使用此方法的时候也应注意一下兼容问题，例如老的浏览器应该先测试下，并且 提供必要的备注。<br />
    9. Resize<br />
    只有Firefox 4和Safari 3支持此属性。Resize是CSS3 UI模型中的一部分，可用于重定义textarea的大小。<br />
    <textarea name="elem" id="elem" rows="5" cols="50"></textarea><br />
    默认情况下webkit浏览器和Firefox 4支持水平和垂直方向上的重定义。<br />
    textarea {<br />
       -moz-resize: vertical;<br />
       -webkit-resize: vertical;<br />
       resize: vertical;<br />
    }<br />
    可能的值：<br />
    both： 重定义水平和垂直方向<br />
    horizontal： 水平调整大小限制<br />
    vertical： 垂直调整大小限制<br />
    none： 不支持重定义<br />
    10、Transition<br />
    也许CSS3最令人兴奋的增补，就是在没有 JavaScript 的元素的情况下产生动画。好像IE9还不支持此功能，但这并不代表你不能使用这个功能，关键是在于提高技能。 现在模仿一个效果，当鼠标滑过右侧链接时，文本向右滑动。<br />
    The HTML</p>
<ul>
<li>
          <a href="#"> Hover Over Me </a>
       </li>
<li>
          <a href="#"> Hover Over Me </a>
       </li>
<li>
          <a href="#"> Hover Over Me </a>
       </li>
<li>
          <a href="#"> Hover Over Me </a>
       </li>
</ul>
<p>    The CSS<br />
    ul a {<br />
        -webkit-transition: padding .4s;<br />
        -moz-transition: padding .4s;<br />
        -o-transition: padding .4s;<br />
        transition: padding .4s;<br />
     }<br />
     a:hover {<br />
        padding-left: 6px;<br />
     }<br />
    transition 有三个参数：<br />
    The property to transition. （Set this value to all if needed） 转换属性。（设置此值为所有如有需要）<br />
    The duration 持续时间<br />
    The easing type 缓动类型<br />
为什么我们不将transition直接应用到hover上呢？是因为我们只是在mouseover时生效，当mouseout时元素将立即返回到 其最初的状态。 因为我们对效果做了调整，所有对旧的浏览器不会产生任何影响。 接下来是通过文章所学，我们来建立的一个简洁的效果。大家可以通过查看源码来学习来。具体如何创建我就不翻译了。</p>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/718.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>axure导出chm文件出现乱码的解决方法</title>
		<link>http://haozi.me/post/716.html</link>
		<comments>http://haozi.me/post/716.html#comments</comments>
		<pubDate>Thu, 01 Sep 2011 06:49:17 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://haozi.me/?p=716</guid>
		<description><![CDATA[1 将生成html文档目录下的后缀为hhc的文件,通过文本文件打开,选择ascii编码的格式另存； 2 将同目录下的hhp文件,用文本文件打开.将Language键值改为:中文(RPC)； 3下载并安装Htmlhelp.exe 4 打开cmd窗口,然后定位到C:Program FilesHTML Help Workshophhc.exe. （默认安装路径） hhc.exe命令后带的参数是:hhp文件的路径. 生成的chm文件,导航页的乱码可以解决.]]></description>
			<content:encoded><![CDATA[<p>1 将生成html文档目录下的后缀为hhc的文件,通过文本文件打开,选择ascii编码的格式另存；<br />
2 将同目录下的hhp文件,用文本文件打开.将Language键值改为:中文(RPC)；<br />
3下载并安装<a href="http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe" title="htmlhelp.exe" target="_blank">Htmlhelp.exe</a><br />
4 打开cmd窗口,然后定位到C:Program FilesHTML Help Workshophhc.exe. （默认安装路径）<br />
hhc.exe命令后带的参数是:hhp文件的路径.<br />
生成的chm文件,导航页的乱码可以解决.</p>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/716.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>定义表格的指定列的属性</title>
		<link>http://haozi.me/post/690.html</link>
		<comments>http://haozi.me/post/690.html#comments</comments>
		<pubDate>Fri, 11 Feb 2011 16:50:04 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://div.li/?p=690</guid>
		<description><![CDATA[首先我们先看看css3中的实现方式： 1.1 CSS3中表格行的选择： css3中有很多很不错的伪类，比如以前很头疼的表格隔行换色问题，只需要用 table tr:nth-child&#40;odd&#41;&#123;background:#CCC&#125;/*定义奇数行的背景色为灰*/ table tr:nth-child&#40;even&#41;&#123;background:#F00&#125;/*定义偶数行的背景色为红*/ 另外，css3中，伪类可以连写，比如我们要设定鼠标hover时，奇数行背景色变成蓝色，可以这样写 table tr:hover:nth-child&#40;odd&#41;&#123;background:#00F&#125;/*鼠标滑过时，第奇数行背景色变成蓝*/ 除了定义奇偶性，我们也可以使用css3强大的nth-child()选择器，定义指定行： table tr:nth-child&#40;2&#41;&#123;background:orange&#125;/*第2行定义为桔色*/ 是不是非常简单？ 查看实例（需要在支持css3属性的浏览器中才能看到效果） 1.2 CSS3中表格列的选择： 列的定义在css3中同样非常简单，唯一不同的不是定义tr而是定义td table td:nth-child&#40;odd&#41;&#123;background:#CCC&#125;/*定义奇数列的背景色为灰*/ table td:nth-child&#40;4&#41;&#123;background:#F00&#125;/*定义第4列背景色为红*/ 查看实例（需要在支持css3属性的浏览器中才能看到效果） =================华丽的分割线===================================== 虽然CSS3的强大选择器相当牛B,可是万恶的IE6不支持，不光IE6不支持，连IE8都不支持。所以在实际应用中，还是要寻求javascript还解决。下面来讲下在jquery中的解决方法： 2.1 jQuery中表格行的选择： $&#40;&#34;table tr:even&#34;&#41;.css&#40;&#34;background&#34;,&#34;#CCC&#34;&#41;;/*定义奇数行的背景色为灰*/ $&#40;&#34;table tr:eq(3)&#34;&#41;.css&#40;&#34;background&#34;,&#34;#F00&#34;&#41;;/*定义第4行的背景色为红*/ 查看实例(这回兼容该死的IE6了) 2.2 jQuery中表格列的选择： javascript里对列的选择要麻烦一点，没有像CSS3里那样现成的定义。可以试下jQuery里的table td:even，效果是与css3里的table td:nth-child(even)不一样的。但我们知道原理也不难。 首先要知道表格的总列数，那么第1列就是td的序数除以列总数余数为0的（jquery数数从0数起的）。 var tdNum = $&#40;&#34;table tr:first td&#34;&#41;.length;//得到表格的列数，即为第一个tr里td的个数。 &#160; &#160; $&#40;&#34;table td&#34;&#41;.each&#40;function&#40;i&#41;&#123; &#160; &#160; &#160; &#160; if &#40;i%tdNum [...]]]></description>
			<content:encoded><![CDATA[<p>首先我们先看看css3中的实现方式：</p>
<h3>1.1 CSS3中表格行的选择：</h3>
<p>css3中有很多很不错的伪类，比如以前很头疼的表格隔行换色问题，只需要用</p>
<div class="codecolorer-container css blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">table tr<span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span>odd<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#CCC</span><span style="color: #00AA00;">&#125;</span><span style="color: #808080; font-style: italic;">/*定义奇数行的背景色为灰*/</span><br />
table tr<span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span>even<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#F00</span><span style="color: #00AA00;">&#125;</span><span style="color: #808080; font-style: italic;">/*定义偶数行的背景色为红*/</span></div></div>
<p>另外，css3中，伪类可以连写，比如我们要设定鼠标hover时，奇数行背景色变成蓝色，可以这样写</p>
<div class="codecolorer-container css blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">table tr<span style="color: #3333ff;">:hover</span><span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span>odd<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#00F</span><span style="color: #00AA00;">&#125;</span><span style="color: #808080; font-style: italic;">/*鼠标滑过时，第奇数行背景色变成蓝*/</span></div></div>
<p>除了定义奇偶性，我们也可以使用css3强大的nth-child()选择器，定义指定行：</p>
<div class="codecolorer-container css blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">table tr<span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span>orange<span style="color: #00AA00;">&#125;</span><span style="color: #808080; font-style: italic;">/*第2行定义为桔色*/</span></div></div>
<p>是不是非常简单？<br />
<a href="/demo/690/1.html" target="_blank">查看实例</a>（需要在支持css3属性的浏览器中才能看到效果）</p>
<h3>1.2 CSS3中表格列的选择：</h3>
<p>列的定义在css3中同样非常简单，唯一不同的不是定义tr而是定义td</p>
<div class="codecolorer-container css blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">table td<span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span>odd<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#CCC</span><span style="color: #00AA00;">&#125;</span><span style="color: #808080; font-style: italic;">/*定义奇数列的背景色为灰*/</span><br />
table td<span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#F00</span><span style="color: #00AA00;">&#125;</span><span style="color: #808080; font-style: italic;">/*定义第4列背景色为红*/</span></div></div>
<p><a href="/demo/690/2.html" target="_blank">查看实例</a>（需要在支持css3属性的浏览器中才能看到效果）<br />
=================华丽的分割线=====================================<br />
虽然CSS3的强大选择器相当牛B,可是万恶的IE6不支持，不光IE6不支持，连IE8都不支持。所以在实际应用中，还是要寻求javascript还解决。下面来讲下在jquery中的解决方法：</p>
<h3>2.1 jQuery中表格行的选择：</h3>
<div class="codecolorer-container javascript blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table tr:even&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;background&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;#CCC&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">/*定义奇数行的背景色为灰*/</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table tr:eq(3)&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;background&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;#F00&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">/*定义第4行的背景色为红*/</span></div></div>
<p><a href="/demo/690/3.html" target="_blank">查看实例</a>(这回兼容该死的IE6了)</p>
<h3>2.2  jQuery中表格列的选择：</h3>
<p>javascript里对列的选择要麻烦一点，没有像CSS3里那样现成的定义。可以试下jQuery里的table td:even，效果是与css3里的table td:nth-child(even)不一样的。但我们知道原理也不难。<br />
首先要知道表格的总列数，那么第1列就是td的序数除以列总数余数为0的（jquery数数从0数起的）。</p>
<div class="codecolorer-container javascript blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> tdNum <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table tr:first td&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//得到表格的列数，即为第一个tr里td的个数。</span><br />
&nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table td&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>i<span style="color: #339933;">%</span>tdNum <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #006600; font-style: italic;">//当前td的序数除以总列数余数为0表示第1列</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;background&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;#F00&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><a href="/demo/690/4.html" target="_blank">查看实例</a><br />
但是还有个问题我至今还没想到好的兼容解决方法。就是在表格里有colspan值的时候，这时候实际td数会少于正常表格。用css3可以很好地定义，但jquery貌似不能</p>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/690.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery捕捉ctrl+enter(回车)事件</title>
		<link>http://haozi.me/post/593.html</link>
		<comments>http://haozi.me/post/593.html#comments</comments>
		<pubDate>Fri, 11 Feb 2011 13:38:37 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://div.li/?p=593</guid>
		<description><![CDATA[网页设置快捷键对提高用户体验很有好处。jQuery中对键盘事件进行了修正 调用函数的时候传入事件即可。 通过事件的which可以找到键码 不过当有组合键的时候还需要注意一下 如ctrl+enter键，虽然都是用e.ctrlKey但是 enter键的键码不是始终为13了 在标准浏览器中 判断 ctrl+enter 是 e.ctrlKey &#038;&#038; e.which ==13 在万恶的ie6中 判断ctrl+enter 是 e.ctrlKey &#038;&#038; e.which ==10 $&#40;document&#41;.keypress&#40;function&#40;e&#41;&#123; &#160; &#160; &#160; &#160; if&#40;e.ctrlKey &#38;&#38; e.witch ==13 &#124;&#124; e.which == 10&#41;&#123; &#160; &#160; &#160; &#160; &#160; &#160; alert&#40;&#34;你按的是ctrl+回车&#34;&#41;; &#160; &#160; &#160; &#160; &#125;else if&#40;e.shiftKey &#38;&#38; e.which==13 &#124;&#124; e.which == 10&#41;&#123; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>网页设置快捷键对提高用户体验很有好处。jQuery中对键盘事件进行了修正<br />
调用函数的时候传入事件即可。<br />
通过事件的which可以找到键码<br />
不过当有组合键的时候还需要注意一下<br />
如ctrl+enter键，虽然都是用e.ctrlKey但是 enter键的键码不是始终为13了<br />
在标准浏览器中 判断 ctrl+enter 是 e.ctrlKey &#038;&#038; e.which ==13<br />
在万恶的ie6中 判断ctrl+enter 是 e.ctrlKey &#038;&#038; e.which ==10</p>
<div class="codecolorer-container javascript blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keypress</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">ctrlKey</span> <span style="color: #339933;">&amp;&amp;</span> e.<span style="color: #660066;">witch</span> <span style="color: #339933;">==</span><span style="color: #CC0000;">13</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">which</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;你按的是ctrl+回车&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">shiftKey</span> <span style="color: #339933;">&amp;&amp;</span> e.<span style="color: #660066;">which</span><span style="color: #339933;">==</span><span style="color: #CC0000;">13</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">which</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;你按的是shift+回车&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">which</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">13</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;你按的是回车&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><a href="/demo/593" target="_blank">查看示例</a></p>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/593.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery准确判断ie6</title>
		<link>http://haozi.me/post/581.html</link>
		<comments>http://haozi.me/post/581.html#comments</comments>
		<pubDate>Wed, 09 Feb 2011 21:44:43 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://div.li/?p=581</guid>
		<description><![CDATA[jquery提供的$.brower方法只能判断浏览器的种类，而不能具体到版本。日常工作中我们最为头疼的就是IE6，有时候要专门为ie6写hack。 以前我的判断方法一直是版本+版本号。 if($.browser.msie&#038;&#038;($.browser.version==6.0))。、 但最近发现一个惊天bug。 jquery是根据userAgent的version值正则判断的，但是如果在windows2008k中，会把windows NT 6.0误认为是ie6.0，导致将ie8误认成ie6。 $.browser方法jquery官方已经不赞成使用了。建议的方法是$.support,但我把所有的属性值都测试完毕后发现没有一个能只检测出IE6的，最后发现$.support.style在IE6和IE7中返回值为false。 那么取他们属性的交集便可以准确判断IE6了。 所以 if($.brower.msie&#038;&#038;($.browser.version==6.0)&#038;&#038;!$.support.style) 虽然很长，但效果还是不错的。]]></description>
			<content:encoded><![CDATA[<p>jquery提供的$.brower方法只能判断浏览器的种类，而不能具体到版本。日常工作中我们最为头疼的就是IE6，有时候要专门为ie6写hack。<br />
以前我的判断方法一直是版本+版本号。 if($.browser.msie&#038;&#038;($.browser.version==6.0))。、<br />
但最近发现一个惊天bug。</p>
<p>jquery是根据userAgent的version值正则判断的，但是如果在windows2008k中，会把windows NT 6.0误认为是ie6.0，导致将ie8误认成ie6。<br />
$.browser方法jquery官方已经不赞成使用了。建议的方法是$.support,但我把所有的属性值都测试完毕后发现没有一个能只检测出IE6的，最后发现$.support.style在IE6和IE7中返回值为false。<br />
那么取他们属性的交集便可以准确判断IE6了。<br />
所以 if($.brower.msie&#038;&#038;($.browser.version==6.0)&#038;&#038;!$.support.style)<br />
虽然很长，但效果还是不错的。</p>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/581.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery图片过大则等比例缩放，图片过小保持原状</title>
		<link>http://haozi.me/post/578.html</link>
		<comments>http://haozi.me/post/578.html#comments</comments>
		<pubDate>Sat, 22 Jan 2011 09:05:49 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://div.li/?p=578</guid>
		<description><![CDATA[图片宽高不能自适应一直是IE6令人头疼的bug。对于一些内容不可控的容器，如论坛帖子正文，必需事先对容器做好设置，防止过大宽图片冲破容器。首先帖出html和css: &#60;div class=&#34;contain&#34;&#62; &#60;p&#62;&#60;img src=&#34;images/VW.jpg&#34; alt=&#34;大众&#34; /&#62;&#60;/p&#62; &#60;p&#62;&#60;img src=&#34;images/BMW.jpg&#34; alt=&#34;宝马&#34; /&#62;&#60;p&#62; &#60;p&#62;&#60;img src=&#34;images/Audi.jpg&#34; alt=&#34;奥迪&#34; /&#62;&#60;/p&#62; 在所有ie6以外的浏览器，只要定义好图片的max-width值，并将height设成auto，即可实现图片的等比例缩放了。 .contain&#123;width:400px; border:1px solid #F00;overflow:hidden&#125; img&#123;border:none;height:auto;max-width:400px&#125; 用js实现图片等比例自适应的原理是: 公式： 图片真实宽度（imgWidth） 图片允许的最大宽度（maxWidth） ——————————— = ——————————————————————— 图片真实高度（imgHeight） 图片允许的最大宽度此时图片的高度（maxHeight） 所以推导出: maxHeight =maxWidth * imgHeight / imgWidth 所以js部分应该这么写： $&#40;document&#41;.ready&#40;function&#40;&#41;&#123; &#160; &#160; var maxWidth = $&#40;&#34;.contain&#34;&#41;.width&#40;&#41;;//找到容器的宽度，图片的最大宽度不能比这大，否则就撑破了 &#160; &#160; $&#40;&#34;img&#34;&#41;.each&#40;function&#40;&#41;&#123; &#160; &#160; &#160; &#160; if&#40;!$.support.style&#38;&#38;$.browser.msie&#38;&#38;&#40;$.browser.version==6.0&#41;&#41;&#123;//为了提高效率，代码只在ie6下才运行js判断。 &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>图片宽高不能自适应一直是IE6令人头疼的bug。对于一些内容不可控的容器，如论坛帖子正文，必需事先对容器做好设置，防止过大宽图片冲破容器。首先帖出html和css:</p>
<div class="codecolorer-container xml blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;contain&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;images/VW.jpg&quot;</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">&quot;大众&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;images/BMW.jpg&quot;</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">&quot;宝马&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;images/Audi.jpg&quot;</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">&quot;奥迪&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>在所有ie6以外的浏览器，只要定义好图片的max-width值，并将height设成auto，即可实现图片的等比例缩放了。</p>
<div class="codecolorer-container css blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.contain</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: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#F00</span><span style="color: #00AA00;">;</span><span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">&#125;</span><br />
img<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><span style="color: #000000; font-weight: bold;">max-width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">&#125;</span></div></div>
<p>用js实现图片等比例自适应的原理是:</p>
<pre style="background:#DDD; padding:5px; margin:5px auto">
公式：
图片真实宽度（imgWidth）                 图片允许的最大宽度（maxWidth）
———————————        =         ———————————————————————
图片真实高度（imgHeight）                图片允许的最大宽度此时图片的高度（maxHeight）

所以推导出:
maxHeight =maxWidth * imgHeight / imgWidth
</pre>
<p>所以js部分应该这么写：</p>
<div class="codecolorer-container javascript blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> maxWidth <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.contain&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//找到容器的宽度，图片的最大宽度不能比这大，否则就撑破了</span><br />
&nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;img&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>$.<span style="color: #660066;">support</span>.<span style="color: #660066;">style</span><span style="color: #339933;">&amp;&amp;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">version</span><span style="color: #339933;">==</span><span style="color: #CC0000;">6.0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #006600; font-style: italic;">//为了提高效率，代码只在ie6下才运行js判断。</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> imgWidth <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//获得容器内每张图片的宽</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> imgHeight <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//获得容器内每张图片的高</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> maxHeight <span style="color: #339933;">=</span> maxWidth<span style="color: #339933;">*</span>imgHeight<span style="color: #339933;">/</span>imgWidth<span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//等比例绽放之关键：计算图片压缩后的高度</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>imgWidth <span style="color: #339933;">&gt;</span> maxWidth<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #006600; font-style: italic;">//判断图片的宽度，如果图片比容器宽才执行缩放，如果比容器小则显示原始尺寸</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">,</span>maxWidth<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">,</span>maxHeight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><a href="/demo/578/1.html" target="_blank">查看实例</a></p>
<p>由于图片大小缩放可能在很多页面里都会使用，所以可以把这个封装成一个插件</p>
<div class="codecolorer-container javascript blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">imgAuto</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>maxWidth<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> imgWidth <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> imgHeight <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> maxHeight <span style="color: #339933;">=</span> maxWidth<span style="color: #339933;">*</span>imgHeight<span style="color: #339933;">/</span>imgWidth<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>imgWidth <span style="color: #339933;">&gt;</span> maxWidth<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">,</span>maxWidth<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">,</span>maxHeight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></div>
<p>在具体图片的地方只要调用</p>
<div class="codecolorer-container javascript blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;img&quot;</span><span style="color: #009900;">&#41;</span> .<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">imgAuto</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//200为图片最大允许的宽度</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></div></div>
<p><a href="/demo/578/2.html" target="_blank">查看实例</a></p>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/578.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>纯css横向下拉菜单</title>
		<link>http://haozi.me/post/576.html</link>
		<comments>http://haozi.me/post/576.html#comments</comments>
		<pubDate>Fri, 21 Jan 2011 10:21:01 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://div.li/?p=576</guid>
		<description><![CDATA[&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; /&#62; &#60;style type=&#34;text/css&#34;&#62; #menu{ margin:0; &#160;padding:0; &#160;list-style:none; &#160;font:14px Arial; &#160;} #menu li{ float:left;margin:0 1px 0 0;} #menu li dl{width:150px; padding:0 0 10px 0; background:#cb6 url(http://www.zishu.cn/attachments/month_0804/62008414231638.jpg) no-repeat bottom left;} #menu li dt{padding:5px;text-align:center;border-bottom:1px solid #b00; background:#ed8 url(http://www.zishu.cn/attachments/month_0804/02008414231556.jpg) no-repeat top left;} #menu li [...]]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container html4strict blackboard" style="border:1px solid #9F9F9F;width:435px;height:700px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">meta</span></a> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span>&gt;</span><br />
#menu{ margin:0; &nbsp;padding:0; &nbsp;list-style:none; &nbsp;font:14px Arial; &nbsp;}<br />
#menu li{ float:left;margin:0 1px 0 0;}<br />
#menu li dl{width:150px; padding:0 0 10px 0;<br />
background:#cb6 url(http://www.zishu.cn/attachments/month_0804/62008414231638.jpg) no-repeat bottom left;}<br />
#menu li dt{padding:5px;text-align:center;border-bottom:1px solid #b00;<br />
background:#ed8 url(http://www.zishu.cn/attachments/month_0804/02008414231556.jpg) no-repeat top left;}<br />
#menu li dt a,#menu li dt a:visited{display:block;color:#333;text-decoration:none;}<br />
#menu li dd{margin:0;padding:0;color:#fff;background-color:#47a;}<br />
#menu li dd.last{border-bottom:1px solid #b00;}<br />
#menu li dd a,#menu li dd a:visited{height:1em;display:block;color:#fff;<br />
text-decoration:none;padding:4px 5px 4px 20px;<br />
background:#47a url(http://www.zishu.cn/attachments/month_0804/y2008414231728.gif) no-repeat 7px 7px;}<br />
#menu li dd{display:none;}<br />
#menu li:hover dd,#menu li a:hover dd{display:block;}<br />
#menu li:hover,#menu li a:hover{width:auto}<br />
/*这句是后来加上的，如果不加会在IE6中有问题；width:auto是我随便写的，你删除后改成disploy:block或其它的内容，只要别它空就行*/<br />
#menu li dd a:hover{ background-color:#147; color:#9cf;}<br />
#menu table{ border-collapse:collapse; padding:0; margin:-1px; font-size:1em;}<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/ul.html"><span style="color: #000000; font-weight: bold;">ul</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu&quot;</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span> <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#nogo&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">dl</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">dt</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Artech Studio<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">dt</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Web Dev<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Web Design<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Books<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;last&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Contact Us<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">dl</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span> <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#nogo&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">dl</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">dt</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Artech Store<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">dt</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Books<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>DVDs<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Movies<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;last&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Service<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">dl</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span> <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#nogo&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">dl</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">dt</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Artech Achi<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">dt</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Landscape<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Plan<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Design<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;last&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Maps<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">dl</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span> <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#nogo&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">dl</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">dt</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Artech Science<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">dt</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Physics<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Maths<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Chemistry<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;last&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Courses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">dd</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">dl</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">li</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/ul.html"><span style="color: #000000; font-weight: bold;">ul</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/576.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>比较简单的异步加载JS文件的代码</title>
		<link>http://haozi.me/post/558.html</link>
		<comments>http://haozi.me/post/558.html#comments</comments>
		<pubDate>Fri, 21 Jan 2011 09:54:48 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://div.li/?p=558</guid>
		<description><![CDATA[&#60;script&#62; function getJsFile&#40;url, callBack&#41;&#123; &#160; &#160; var XH = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject&#40;'Msxml2.XMLHTTP'&#41;; &#160; &#160; XH.open&#40;'get',url,true&#41;; &#160; &#160; XH.onreadystatechange = function&#40;&#41;&#123; &#160; &#160; &#160; &#160; if&#40;XH.readyState == 4 &#38;&#38; XH.status == 200&#41;&#123; &#160; &#160; &#160; &#160; &#160; &#160; if&#40;window.execScript&#41; window.execScript&#40;XH.responseText&#41;; &#160; &#160; &#160; &#160; &#160; &#160; else eval.call&#40;window, XH.responseText&#41;; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container javascript blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span><br />
<span style="color: #003366; font-weight: bold;">function</span> getJsFile<span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> callBack<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> XH <span style="color: #339933;">=</span> window.<span style="color: #660066;">XMLHttpRequest</span> <span style="color: #339933;">?</span> <span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Msxml2.XMLHTTP'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; XH.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'get'</span><span style="color: #339933;">,</span>url<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; XH.<span style="color: #660066;">onreadystatechange</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>XH.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">4</span> <span style="color: #339933;">&amp;&amp;</span> XH.<span style="color: #000066;">status</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">execScript</span><span style="color: #009900;">&#41;</span> window.<span style="color: #660066;">execScript</span><span style="color: #009900;">&#40;</span>XH.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">eval</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span>window<span style="color: #339933;">,</span> XH.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span>callBack<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; XH.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
<div class="codecolorer-container javascript blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">//test</span><br />
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span><br />
<span style="color: #003366; font-weight: bold;">function</span> cb<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; abc<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
getJsFile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://div.li/wp/wp-content/themes/tweetmeblue/js/carousel/stepcarousel.js'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'cb'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/558.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>让 标签中的内容自动换行的兼容写法</title>
		<link>http://haozi.me/post/548.html</link>
		<comments>http://haozi.me/post/548.html#comments</comments>
		<pubDate>Fri, 21 Jan 2011 08:50:00 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://div.li/wp/?p=548</guid>
		<description><![CDATA[让&#60;pre&#62; 标签中的内容自动换行并符合 W3C 标准（多浏览器支持） 默认情况下， &#60;pre&#62; 标签中的内容若超出范围不会自动换行，这样会造成很糟糕的水平滚动条影响效果。 下面提供符合 W3C 标准并支持多浏览器的 CSS 样式代码： pre&#123; white-space:pre-wrap;/*css3标准写法*/ white-space:-moz-pre-wrap;/*兼容老版本火狐*/ white-space:-pre-wrap;/*Opera4*/ white-space:-o-pre-wrap;/*Opera7*/ word-wrap:break-word;/*万恶的IE6*/&#125; PS：新版的火狐、opera、chrome都已经全面支持css3属性，一般用非IE浏览器的用户都能折腾，早换新版了。所以可以简写 pre&#123; white-space:pre-wrap;/*css3标准写法*/ word-wrap:break-word;/*万恶的IE6*/&#125;]]></description>
			<content:encoded><![CDATA[<p>让&lt;pre&gt; 标签中的内容自动换行并符合 W3C 标准（多浏览器支持）<br />
默认情况下，<br />
&lt;pre&gt;  标签中的内容若超出范围不会自动换行，这样会造成很糟糕的水平滚动条影响效果。<br />
下面提供符合 W3C 标准并支持多浏览器的 CSS 样式代码：</p>
<div class="codecolorer-container css blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pre<span style="color: #00AA00;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #3333ff;">:pre-</span>wrap<span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/*css3标准写法*/</span><br />
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #3333ff;">:-moz-pre-</span>wrap<span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/*兼容老版本火狐*/</span><br />
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #3333ff;">:-pre-</span>wrap<span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/*Opera4*/</span><br />
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #3333ff;">:-o-pre-</span>wrap<span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/*Opera7*/</span><br />
word-wrap<span style="color: #3333ff;">:break-</span>word<span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/*万恶的IE6*/</span><span style="color: #00AA00;">&#125;</span></div></div>
<p>PS：新版的火狐、opera、chrome都已经全面支持css3属性，一般用非IE浏览器的用户都能折腾，早换新版了。所以可以简写</p>
<div class="codecolorer-container css blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pre<span style="color: #00AA00;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #3333ff;">:pre-</span>wrap<span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/*css3标准写法*/</span><br />
word-wrap<span style="color: #3333ff;">:break-</span>word<span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/*万恶的IE6*/</span><span style="color: #00AA00;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/548.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>九妹初体验</title>
		<link>http://haozi.me/post/543.html</link>
		<comments>http://haozi.me/post/543.html#comments</comments>
		<pubDate>Thu, 06 Jan 2011 11:06:06 +0000</pubDate>
		<dc:creator>耗子</dc:creator>
				<category><![CDATA[other]]></category>
		<category><![CDATA[鸡鸡歪歪]]></category>

		<guid isPermaLink="false">http://haozi.cc/?p=543</guid>
		<description><![CDATA[今天下午去了趟华强北，办完事后顺便去了下魅族专卖店。魅族的专卖店里果然热闹，很多煤油在里面玩。虽然现在M9已经开始正式发售，但早已被预定完毕，店里只有几部样机。&#160; 由于我很喜欢M8，自己10年年初就入手了一只M8，对于M9，也很早就在魅族的网站上关注了。这次M9是千呼万唤始出来，当然令我兴奋不己。网上的测评写得再多再好也不如自己感受的真实。这年代，是软文与资讯齐飞的时代，连当年CECT这样的垃圾机，测评不也写得有模有样么。广告做得好，不如疗效好，我这里就讲下我的摸妹感受&#160; &#160; 由于自己手机没电，当时没有拍照，只能看我文字解说了 &#160; 简单的概括一下这个手机，这就是硬件上配备了最强的手机单核处理器和图形处理模块，搭载了和iPhone4一样分辨率的可以超过人眼识别极限的Retina 屏幕，各类传感器啊GPS啊陀螺仪啊什么的全有，再加上了能够拍摄720p视频的500万像素摄像头，软件上呢，内核是Google开发的 Android，2.2的版本也算很新了，魅族又自己开发了一套外观界面，另外鸡王也在论坛是爆料春节前很有可能上android2.3，另外2500的价格，这一切足以上火腿肠（HTC）内牛满面！ &#160; 我们按照体验顺序来： 1、 &#160;机器远看，容易被认为是iPhone 4，因为造型外观比较相似，正面是玻璃材质，看起来质感不错。 2、 &#160;拿起机器，第一感觉是轻，去除了M8采用的金属外框之后，M9基本就是全塑料产品了，这点不太好。 3、 &#160;机器由于分辨率同iPhone一样，而比其他Android的机型更接近正方形，因而宽度上同N1、G7差不多，但是长度短一些，大小约为iPod touch那么大，放在裤兜很舒服。 4、 &#160;厚度上摆在桌子上我们看起来跟N1、G7、iPhone 4算是一般厚，其实现在手机见多了，就没什么惊艳的感觉了。 5、 &#160;反过来，后盖的设计看起来是一体化的，而且磨砂的手感很好，总体如果你摸过ThinkPad笔记本的话，就跟那个上盖的手感是一样的。 6、 &#160;综合2和5，可见M9发布后相关手机套会大卖，而且以彩色和增重功能为主&#8230;&#8230; 7、 &#160;点亮机器，解锁方法同M8一样，向上提，相对其他品牌还算有创意，但我感觉M8的锁屏界面更漂亮。 8、 &#160;这个屏幕真的很养眼，夏普出品，正面亮度也很高，锐利，文字控和上网控的最佳选择。 9、 &#160;但是由于不是ips，可视角度较差，不过也好，手机这东西很多场合无需分享屏幕内容。 10、 屏幕色彩还原真实。 11、 按键不是标准Android规格，搜索键被取消，键位比较合理，按中间回到桌面也让只见过苹果的人比较容易上手。 12、 主键旁边的两个键是电容的，不能按下，触摸就有反应，但是背光灯常亮。 13、 主键手感比较绵软，静音的，跟苹果的那种偏硬的不一样。 14、 整体屏幕触控效果不错，操作很流畅。 15、 软件方面凡是常规软件（非游戏）兼容的都不错。 16、 游戏上比较紧张，因为分辨率太高，基本上Gameloft的游戏都阵亡了，只能显示在屏幕的左下角，但是EA的却都不错，要么全屏，要么就上下黑边，想看电影一样。 17、 视频解码能力很是了得，基本上网上能下载到视频拖进去就能看，当MP4足够了。 18、 硬件现在有限制，主频应该是1G，但是锁频在800Mhz，据说过两天要开放。 19、 部分细节还需完善，举例说明，滑动照片竖着就行，横着就不行&#8230;&#8230;而且调整屏幕亮度时出现屏闪。 20、 信号很好，不过我没敢把手机带出店铺，只能凭直觉。 21、 拍照就那样了，不过视频很强悍，能拍720p的视频，相当流畅。 [...]]]></description>
			<content:encoded><![CDATA[<p>今天下午去了趟华强北，办完事后顺便去了下魅族专卖店。魅族的专卖店里果然热闹，很多煤油在里面玩。虽然现在M9已经开始正式发售，但早已被预定完毕，店里只有几部样机。&nbsp;</p>
<div>由于我很喜欢M8，自己10年年初就入手了一只M8，对于M9，也很早就在魅族的网站上关注了。这次M9是千呼万唤始出来，当然令我兴奋不己。网上的测评写得再多再好也不如自己感受的真实。这年代，是软文与资讯齐飞的时代，连当年CECT这样的垃圾机，测评不也写得有模有样么。广告做得好，不如疗效好，我这里就讲下我的摸妹感受&nbsp;<img alt="" src="http://haozi.cc/upfield/wp/wp-content/plugins/deans-fckeditor-with-pwwangs-code-plugin-for-wordpress/smiles/msn/shades_smile.gif" /></div>
<div>&nbsp;</div>
<div>由于自己手机没电，当时没有拍照，只能看我文字解说了</div>
<div>&nbsp;</div>
<div>简单的概括一下这个手机，这就是硬件上配备了最强的手机单核处理器和图形处理模块，搭载了和iPhone4一样分辨率的可以超过人眼识别极限的Retina 屏幕，各类传感器啊GPS啊陀螺仪啊什么的全有，再加上了能够拍摄720p视频的500万像素摄像头，软件上呢，内核是Google开发的 Android，2.2的版本也算很新了，魅族又自己开发了一套外观界面，另外鸡王也在论坛是爆料春节前很有可能上android2.3，另外2500的价格，这一切足以上火腿肠（HTC）内牛满面！</div>
<div>&nbsp;</div>
<div>我们按照体验顺序来：</div>
<div>1、 &nbsp;机器远看，容易被认为是iPhone 4，因为造型外观比较相似，正面是玻璃材质，看起来质感不错。</div>
<div>2、 &nbsp;拿起机器，第一感觉是轻，去除了M8采用的金属外框之后，M9基本就是全塑料产品了，这点不太好。</div>
<div>3、 &nbsp;机器由于分辨率同iPhone一样，而比其他Android的机型更接近正方形，因而宽度上同N1、G7差不多，但是长度短一些，大小约为iPod touch那么大，放在裤兜很舒服。</div>
<div>4、 &nbsp;厚度上摆在桌子上我们看起来跟N1、G7、iPhone 4算是一般厚，其实现在手机见多了，就没什么惊艳的感觉了。</div>
<div>5、 &nbsp;反过来，后盖的设计看起来是一体化的，而且磨砂的手感很好，总体如果你摸过ThinkPad笔记本的话，就跟那个上盖的手感是一样的。</div>
<div>6、 &nbsp;综合2和5，可见M9发布后相关手机套会大卖，而且以彩色和增重功能为主&hellip;&hellip;</div>
<div>7、 &nbsp;点亮机器，解锁方法同M8一样，向上提，相对其他品牌还算有创意，但我感觉M8的锁屏界面更漂亮。</div>
<div>8、 &nbsp;这个屏幕真的很养眼，夏普出品，正面亮度也很高，锐利，文字控和上网控的最佳选择。</div>
<div>9、 &nbsp;但是由于不是ips，可视角度较差，不过也好，手机这东西很多场合无需分享屏幕内容。</div>
<div>10、 屏幕色彩还原真实。</div>
<div>11、 按键不是标准Android规格，搜索键被取消，键位比较合理，按中间回到桌面也让只见过苹果的人比较容易上手。</div>
<div>12、 主键旁边的两个键是电容的，不能按下，触摸就有反应，但是背光灯常亮。</div>
<div>13、 主键手感比较绵软，静音的，跟苹果的那种偏硬的不一样。</div>
<div>14、 整体屏幕触控效果不错，操作很流畅。</div>
<div>15、 软件方面凡是常规软件（非游戏）兼容的都不错。</div>
<div>16、 游戏上比较紧张，因为分辨率太高，基本上Gameloft的游戏都阵亡了，只能显示在屏幕的左下角，但是EA的却都不错，要么全屏，要么就上下黑边，想看电影一样。</div>
<div>17、 视频解码能力很是了得，基本上网上能下载到视频拖进去就能看，当MP4足够了。</div>
<div>18、 硬件现在有限制，主频应该是1G，但是锁频在800Mhz，据说过两天要开放。</div>
<div>19、 部分细节还需完善，举例说明，滑动照片竖着就行，横着就不行&hellip;&hellip;而且调整屏幕亮度时出现屏闪。</div>
<div>20、 信号很好，不过我没敢把手机带出店铺，只能凭直觉。</div>
<div>21、 拍照就那样了，不过视频很强悍，能拍720p的视频，相当流畅。</div>
<div>22、 虚拟键盘同M8不一样了，比较类似iPhone</div>
<div>23、 输入法魅族自己做了一套，不知道装第三方会怎么样，不过我也只用笔画，能按笔顺打字就表示毫无压力。</div>
<div>24、 短信界面相对原生Android好很多。不过我还是更喜欢M8的，M9的文字输入框只有一行，要第一行撑满才能到第二行。</div>
<div>25、 不知道是怎么搞的，M9保留了N多google原生服务，我很喜欢。</div>
<div>26、 电池等因时间所限，没有感触。电池1350mA,M8是1200mA，但由于M9屏幕要大，估计待机时间不会比M8高多少，勉强2-3天吧，如果玩机的估计只有一天。</div>
<div>27、 主题界面省了菜单，就是取消了Android界面以前正中的那个进入程序列表的功能，只能像iPhone一样铺在桌面上，程序控表示压力很大。</div>
<div>28、 速度相当快，而且是实打实的速度，比如放大图片，完全是实时的，不想iphone，先模糊放大，再逐渐补齐像素。之间我一不会玩智能机的MM告诉我她的摸机体验，说不流畅，我表示难以置信，结果发现是她不太会玩触摸屏。</div>
<div>&nbsp;</div>
<div>总体讲，整体很完美，细节待完善，适合用机，玩机的还得慢慢摸索。魅族这家企业我很敬重，国货还在好好做的也就魅族和联想了，可是还在为用户着想的就剩魅族 了。我不担心这个机器的性能和服务，我担心的是魅族能不能一直坚持以M8的态度对待新产品，只有做精，做好口碑，才能做强。</div>
]]></content:encoded>
			<wfw:commentRss>http://haozi.me/post/543.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

