<?xml version="1.0" encoding="gb2312"?>
<rss version="2.0">
<channel>
<title><![CDATA[制作手记]]></title>
        <image>
        <title>http://hi.baidu.com</title>
        <link>http://hi.baidu.com</link>
        <url>http://img.baidu.com/img/logo-hi.gif</url>
        </image>
<description><![CDATA[(x)Html、Css、Javascript、ajax，网页标准和易用性，网页制作相关的实用技术 ---- 把事情简单化]]></description>
<link>http://hi.baidu.com/webworker</link>
<language>zh-cn</language>
<generator>www.baidu.com</generator>
<ttl>5</ttl>


<item>
        <title><![CDATA[JsonP / Google AJAX Libraries API / Mashup]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/6b0caf864c7d013b66096e50.html]]></link>
        <description><![CDATA[
		
		最近经常上豆瓣，也关注了一下他们最近推出的API服务，据说淘宝也将开放API，google更是不用说，开始为众多的ajax库提供服务器端分发服务。越来越多的网站开始提供API服务，也表示有越来越多的Mashup可能性，抛砖引玉，希望越来越多的开发者加入到这个领域。<br>
<br>
<strong>一、JsonP + API：Javascrpt中跨域调用数据<br>
<br>
先了解下JsonP（JSON with Padding）：</strong>利用script标签，通过特定的src地址的调用，来执行一个客户端的js函数，<strong>在服务器端生成相对的数据</strong><strong>（json格式）</strong><strong>并以参数的形式</strong><strong>传递</strong><strong>给这个客户端的js函数并执行</strong>这个函数，前提是需要<strong>服务器端的数据输出支持</strong>。<br>
<br>
以delicious的API提供的jsonp支持为例。<br>
<br>
<strong>1. </strong>我们先在客户端写一个带参数的<strong>函数doyourwork</strong>以便处理返回的数据：<br>
&nbsp;&nbsp;&nbsp;                 &lt;script type=&quot;text/javascript&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;                 &lt;!--<br>
&nbsp;&nbsp;&nbsp;                 function doyourwork(data){<br>
&nbsp;&nbsp;&nbsp;                    alert(data);<br>
&nbsp;&nbsp;                 &nbsp;&nbsp;                    //处理数据代码....<br>
&nbsp;&nbsp;&nbsp;                 }<br>
&nbsp;&nbsp;&nbsp;                 //--&gt;<br>
&nbsp;&nbsp;&nbsp;                 &lt;/script&gt;<br>
<br>
<br>
<strong>2. </strong>通过script标签，调用http://feeds.delicious.com/feeds/json/bob?<strong>callback=doyourwork 生成数据</strong>并作为<strong>参数传入doyourwork来执行</strong><strong>函数</strong>：<br>
&lt;script type=&quot;text/javascript&quot; src=&quot;http://feeds.delicious.com/feeds/json/bob?callback=doyourwork&quot;&gt;&lt;/script&gt;<strong><br>
这一行相当于执行以下javascript代码：</strong><strong>    doyourwork(</strong>服务器端生成的数据<strong>)  </strong>--- 以服务器端生成的数据为参数执行js函数doyourwork<strong>。</strong><br>
<strong> <br>
<br>
</strong>当然，现在很多的<strong>js库</strong>都已经有相应的支持，用起来很方便，比如在<strong>jquery</strong>中，可以这样<br>
<strong>$.getJSON(</strong>&quot;http://feeds.delicious.com/feeds/json/bob?callback=&quot;, function(data){<br>
&nbsp;&nbsp;&nbsp;               alert(data); <br>
&nbsp;&nbsp;&nbsp;               //处理数据代码....<br>
});<strong><br>
</strong> <br>
<strong>更具体的东西请我<a href="http://code.google.com/p/bookr-air/downloads/detail?name=search_with_api.rar&amp;can=2&amp;q=#makechanges" target="_blank">google code</a>上的例子。</strong><br>
<br>
参考 <strong><a href="http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/" target="_blank">remote json jsonp</a><br>
<br>
<br>
二、Google AJAX Libraries API   for  Mashup！<br>
<br>
</strong>Google的<a href="http://almaer.com/blog/" target="_blank">Dion Almaer</a>也开始在<a href="http://ajaxian.com/archives/announcing-ajax-libraries-api-speed-up-your-ajax-apps-with-googles-infrastructure" target="_blank">ajaxian.com</a>上推广<strong><a href="http://code.google.com/apis/ajaxlibs/" target="_blank">AJAX Libraries API</a></strong>：其实就是<strong>把各种AJAX库放在google的服务器上，为开发者提供更快更好的调用服务</strong>。<br>
<br>
目前已经提供的AJAX库包括：<a href="http://jquery.com/" target="_blank">jQuery</a> / <a href="http://www.prototypejs.org/" target="_blank">prototype</a> / <a href="http://script.aculo.us/" target="_blank">script_aculo_us</a> / <a href="http://mootools.net/" target="_blank">MooTools</a> / <a href="http://dojotoolkit.org/" target="_blank">dojo</a>。<br>
<br>
<strong>调用方式一</strong><br>
&lt;script src=&quot;<strong>http://www.google.com/jsapi</strong>&quot;&gt;&lt;/script&gt;<br>
&lt;script&gt;<br>
// 加载 jQuery； 版本:可以选1，会自动加载1的最新版本1.2.6；压缩（可选）：参数uncompressed<br>
<strong>google.load</strong>(&quot;jquery&quot;, &quot;1.2.6&quot;, {uncompressed:true});<br>
<br>
// 页面加载完成后执行下面程序<br>
<strong>google.setOnLoadCallback</strong>(function() {<br>
&nbsp;&nbsp;&nbsp;       $(&quot;&lt;p&gt;jQuery load completed&lt;/p&gt;&quot;).appendTo(&quot;body&quot;);<br>
});<br>
&lt;/script&gt;<br>
<br>
<strong><br>
调用方式二</strong><br>
&lt;script src=&quot;<strong>http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js</strong>&quot;&gt;&lt;/script&gt;<br>
&lt;script&gt;<br>
&nbsp;&nbsp;&nbsp;       $(&quot;&lt;p&gt;jQuery load completed&lt;/p&gt;&quot;).appendTo(&quot;body&quot;);<br>
&lt;/script&gt;<br>
<strong> </strong> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/6b0caf864c7d013b66096e50.html#comment">查看评论</a>]]></description>
        <pubDate>2008-05-27  15:09</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/6b0caf864c7d013b66096e50.html</guid>
</item>

<item>
        <title><![CDATA[CSS文件的通用部分]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/29d7b87eb2ae523d0cd7da9c.html]]></link>
        <description><![CDATA[
		
		最近在这里贴了些比较虚的东西，其实我只是coder，最基础的是实用，可操作性。<br>
<br>
下面是我的css模板的部分，纯属个人习惯，每个人都可以根据自己的习惯，做一个差不多的css模板，以后做东西的时候拿来改改就可以用了，可以节省一些时间。<br>
<br>
body{margin:0 auto;background: #fff;color:#333;} //正文颜色不是纯黑<br>
body,td,select, input, textarea{font:12px/1.5em arial,&quot;宋体&quot;,helvetica,clean,sans-serif;}//字体大小有的情况下不能继承<br>
td{vertical-align:top;}//表格单元的内容垂直方向顶部对齐<br>
table{border-collapse: collapse; border-spacing:0;  border:0;}//削除表格边框和间隙<br>
img{border:0;}//去除图片边框(加链接的图片)<br>
form{margin:0;padding:0;}//这个有时候容易被忽视<br>
a:link{color:#369;text-decoration:none;}//改变默认的超链接样式，颜色和下划线<br>
a:visited{color:#888;text-decoration:none;}<br>
a:hover{color:#f00; text-decoration:underline;}<br>
a:active{color:#fc0; text-decoration:none;}<br>
<strong><br>
*{margin:0;padding:0;}</strong>会重置所有的标签，有利有弊，可以节省很多代码，但会牵连有些不想被重置的标签，有些标签虽然被重置了，但是你的页面根本没有这些标签，如果标签多的时候效率可能不好，这样的讲究可能稍微有些过了。<br>
<br>
Referrence:<a target="_blank" href="http://www.snook.ca/archives/html_and_css/no_css_reset/">No CSS Reset</a> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Css">Css</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/29d7b87eb2ae523d0cd7da9c.html#comment">查看评论</a>]]></description>
        <pubDate>2008-04-30  15:45</pubDate>
        <category><![CDATA[Css]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/29d7b87eb2ae523d0cd7da9c.html</guid>
</item>

<item>
        <title><![CDATA[D2论坛第一日（D1 @ D2）]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/513c124c32a6ebfcd62afc17.html]]></link>
        <description><![CDATA[
		
		在<a target="_blank" href="http://d2forum.cn/index.html">D2</a>的会场待了一天，听四个不同风格人讲不同的东西。<br>
<br>
<br>
<strong><a href="http://blog.csdn.net/aimingoo/" target="_blank">周爱民</a><br>
</strong>  <br>
上午入场的时候，在门口填问卷拿了第四期的《程序员》，上面正好有爱民的一篇文章《做人、做事、做架构师&mdash;&mdash;架构师能力模型解析》，但是他要讲的却是&ldquo;前端设计与开发的基本模式&rdquo;。<br>
他的讲演内容比较丰富，讲了很多比较虚的概念和理论，象用户、内容、输出设备、焦点的意图/向性/行为引导等，可以增加知识构成，最后拿出来一个公式：U=E2+C2(Effect/Experience、Control/Context)。<br>
期间提了三个比较简单的问题，送出三本他的关于javascript的新书，和台下的我们互动不错。<br>
<br>
<br>
<font color="#0000ff"><strong>黄继佳</strong></font><br>
<br>
下午的第一场，讲到Silverlight 2的新特性，一听用记事本对Xaml和Javascript的编辑进行开发已经是历史，现在需要runtime以外的 .net环境(vs200x)支持开发，我松了一口气，以后不用花太多时间在这个东西上了。不过黄继佳的讲演还是不错的，给出了很多的应用demo，还现场codeing了一些简单实例。<br>
<br>
<strong><br>
<a href="http://blog.hedgerwow.com/" target="_blank">Hedger Wang</a></strong> <br>
<br>
Hedger是现在yahoo group的tech lead，台湾人(王玺?)，他的讲演很精彩，也很实在很具体，展示了他的许多js和php函数，目的就是如何有效管理ajax异步请求，节约企业资源，notepad++是他的编辑器，而不是.net等自动生成代码的工具，观众提问很具体很具体很。。。<br>
<br>
<br>
<strong> <a href="http://nate.koechley.com/blog/" target="_blank">Nate Koechley</a></strong><br>
<br>
纳特-科克莱是Nate名片上的中文名，职位雅虎高级前端工程师，他的展示上有句话这么说：&quot;We tell browsers what to do&quot;。yui是他的主题，也是他的工作，Progressive Enhancement是隐含的讲演主题。虽然现在一些yui的模块用起来会越来越简单，但是html标签里的id和class实在太多。关于其他，我没有在实际中用过因此没有发言权。最后八卦一下，Nate的笔记本和他的数码设备（在我的相册里）。<br>
<br>
<strong>相关图片请看<a href="http://hi.baidu.com/webworker/album/%C4%AC%C8%CF%CF%E0%B2%E1" target="_blank">我的相册</a></strong><br>
<div align="center" forimg="1"> </div> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/%D7%DB%BA%CF">综合</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/513c124c32a6ebfcd62afc17.html#comment">查看评论</a>]]></description>
        <pubDate>2008-04-28  17:32</pubDate>
        <category><![CDATA[综合]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/513c124c32a6ebfcd62afc17.html</guid>
</item>

<item>
        <title><![CDATA[Jens Meiert 关于学习]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/7238cbcece85fa0693457e25.html]]></link>
        <description><![CDATA[
		
		这两天看<a target="_blank" href="http://meiert.com/en/">Jens Meiert</a>（一个1978年生的开始为google工作的德国人）的blog，在这里分享和总结一些关于学习的东西。<br>
<br>
Jens Meiert写过两篇过于做网站的如何学习的文章，一篇是关于策略的<a target="_blank" href="http://meiert.com/en/blog/20071102/learning-strategies/">3 Great Learning Strategies for Generalists</a>一片是关于具体操作的<a target="_blank" href="http://meiert.com/en/blog/20080201/professional-web-developer/">What Makes a Professional Web Developer?</a>大致总结如下，可能和原文意思有些偏差，大家可以去看下原文。<br>
<strong><br>
<font color="#000000"><a href="http://meiert.com/en/blog/20071102/learning-strategies/" target="_blank"> 怎么学习</a></font></strong><br>
1.80/20法则，花80%的时间来关注和学习你的目标对象<br>
2.拥有好的榜样和可靠的信息来源，可以少走很多弯路<br>
3.不要强行记忆某些东西，而是不断地使用它们<br>
<br>
<font color="#000000"><a href="http://meiert.com/en/blog/20080201/professional-web-developer/" target="_blank"><strong>如何学习</strong></a></font><br>
1.学习web标准--阅读规范文档；<br>
2.理解可用性、亲和性--网站如何为各种设备和所有人服务；<br>
3.独立思维--结构、表现、行为三层分离；<br>
4.实践--尽量手写代码；<br>
<br>
最近在blog的右侧加上了一些链接，<strong>好的榜样和可靠的信息来源，可以节省很多的学习成本</strong>。<br>
<br>
附某个大奖去年的宣传语：你看到的越多你能想到的也就更多(the more things you see, the more idea you have) 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/%D7%DB%BA%CF">综合</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/7238cbcece85fa0693457e25.html#comment">查看评论</a>]]></description>
        <pubDate>2008-04-10  18:02</pubDate>
        <category><![CDATA[综合]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/7238cbcece85fa0693457e25.html</guid>
</item>

<item>
        <title><![CDATA[自定义下拉表单select style]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/190874d990eca4ed38012fa1.html]]></link>
        <description><![CDATA[
		
		下拉表单select是表单中的特例，首先是ie和ff下css样式的不同表现，还有在ie6下，它的z-index级别高，会出现在他的覆盖层上。。。总之做出一个漂亮的select比较费事。<br>
<br>
下面通过javascript和css结合做了一个自定义select样式的函数。思路如下：<br>
&nbsp;&nbsp;&nbsp;  1.隐藏默认表单<br>
&nbsp;&nbsp;&nbsp;  2.取得表单坐标位置<br>
&nbsp;&nbsp;&nbsp;  3.在原位置创建一个没有触发的select和点击事件<br>
&nbsp;&nbsp;&nbsp;  4.在对应位置创建一个触发后的select和option<br>
&nbsp;&nbsp;&nbsp;  5.根据鼠标在模拟select上的事件改变没有触发的select的文本和原来select的值<br>
<br>
<strong>Javascript</strong><br>
<strong>function si(o,oc,ic){</strong><br>
//参数1：需要样式化的select的id，参数2：替代select的calss，参数1：替代触发后的select的class<br>
<br>
//<strong>隐藏</strong>默认的select<br>
&nbsp;&nbsp;&nbsp;  var o = document.getElementById(o);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  o.style.visibility = &quot;hidden&quot;; <br>
&nbsp;&nbsp;&nbsp;  var l = o.options.length;<br>
<br>
//获取select的坐标位置<br>
&nbsp;&nbsp;&nbsp;  var x = o.offsetLeft;<br>
&nbsp;&nbsp;&nbsp;  var y = o.offsetTop;<br>
<br>
//创建<strong>模拟的select</strong><br>
&nbsp;&nbsp;&nbsp;  var n = document.createElement(&quot;div&quot;);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.className = oc;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.style.position = &quot;absolute&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.style.left = x + &quot;px&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.style.top = y + &quot;px&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.style.width = o.offsetWidth - 2 + &quot;px&quot;;//宽度可以根据实际情况调整<br>
&nbsp;&nbsp;&nbsp;  var n_c = document.createTextNode(o.options[o.selectedIndex].innerHTML);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.appendChild(n_c);<br>
&nbsp;&nbsp;&nbsp;  var pn = o.parentNode;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  pn.insertBefore(n, o);<br>
<br>
<br>
//创建模拟的select的选择状态下的包含容器<br>
&nbsp;&nbsp;&nbsp;  var ns = document.createElement(&quot;div&quot;);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.className = ic;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.style.display = &quot;none&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.style.position = &quot;absolute&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.style.left = x + &quot;px&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.style.top = y + &quot;px&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.style.width = o.offsetWidth - 2 + &quot;px&quot;;//宽度可以根据实际情况调整<br>
<br>
//创建<strong>模拟的选择状态下的select</strong><br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  for(var i=0;i&lt;l;i++){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  //创建模拟的select的option文本内容<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  var nsc  = document.createElement(&quot;div&quot;);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  var ns_c = document.createTextNode(o.options[i].innerHTML);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  nsc.appendChild(ns_c);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.appendChild(nsc);<br>
<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  //模拟option的鼠标滑过效果<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  nsc.onmouseover = function(){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  this.style.background = &quot;red&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  nsc.onmouseout = function(e){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  this.style.background = &quot;&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  if (window.event){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  window.event.cancelBubble = true;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  } else{<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  e.stopPropagation();<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  //<strong>模拟option的选取效果</strong><br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  nsc.onclick = function(){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.innerHTML = this.innerHTML;//改变模拟select的内容<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  for(var j=0;j&lt;l;j++){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  if(o.options[j].value==n.innerHTML){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  o.options[j].selected = &quot;selected&quot;;//改变原来select的value<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.style.display = &quot;&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.style.display = &quot;none&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  //添加模拟的选择状态下的select<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  pn.insertBefore(ns, o);<br>
<br>
<br>
//<strong>点击显示模拟的option内容</strong><br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.onclick = function(){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.style.display = &quot;none&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.style.display = &quot;&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
<br>
//<strong>鼠标移开隐藏模拟option的内容（存在问题，有时候不隐藏）</strong><br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.onmouseout = function(e){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  n.style.display = &quot;&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ns.style.display = &quot;none&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
<br>
}<br>
<br>
<strong>HTML</strong><br>
&lt;div class=&quot;s&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;select id=&quot;<strong>sel</strong>&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;option value=&quot;请选择&quot; selected=&quot;selected&quot;&gt;请选择&lt;/option&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;option value=&quot;选项一&quot;&gt;选项一&lt;/option&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;option value=&quot;选项二&quot;&gt;选项二&lt;/option&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;option value=&quot;选项三&quot;&gt;选项三&lt;/option&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;option value=&quot;选项四&quot;&gt;选项四&lt;/option&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;/select&gt;<br>
&lt;/div&gt;<br>
&lt;script type=&quot;text/javascript&quot;&gt;<br>
&lt;!--<br>
&nbsp;&nbsp;&nbsp;  <strong>si(&quot;sel&quot;,&quot;n_sel&quot;,&quot;ns_sel&quot;);</strong><br>
//--&gt;<br>
&lt;/script&gt;<br>
<br>
<strong>CSS</strong><br>
body,select{margin:0;padding:0;font:12px arial; }<br>
.s{margin:100px;padding:10px; }<br>
.<strong>n_sel</strong>{padding-top:2px;background: #f8f8f8 url(r_dot.jpg) 50px 6px no-repeat;cursor:pointer;border: 1px solid #ccc;}<br>
.<strong>ns_sel</strong>{background: #ffc url(r_dot.jpg) 50px 6px no-repeat;border: 1px solid #ccc;}<br>
.ns_sel div{padding-top:2px;cursor:pointer;position: relative; }<br>
&lt;/div&gt; 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/190874d990eca4ed38012fa1.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-29  12:56</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/190874d990eca4ed38012fa1.html</guid>
</item>

<item>
        <title><![CDATA[可以自动轮换的页签 tabs with auto play fucntion]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/fce701f78eeaff26730eece5.html]]></link>
        <description><![CDATA[
		
		现在到处都是页签(tab)，有不自动播放的，可以不断自动循环的，只循环一次的，点击以后继续循环，或者停止循环，最近琢磨着，写了一个函数，基本上可以实现这些基本功能。<br>
<br>
下面是应用实例和函数，可能html部分的id有点多，很多地方还有待改善。<br>
<br>
&lt;dl id=&quot;tab_01&quot; class=&quot;tab&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;dt id=&quot;tab_01&quot;&gt;结构&lt;/dt&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;dd id=&quot;tabs_01&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;h2&gt;Structure&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;p&gt;XHTML、XML&lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;/dd&gt;<br>
<br>
&nbsp;&nbsp;&nbsp;  &lt;dt id=&quot;tab_02&quot;&gt;表现&lt;/dt&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;dd id=&quot;tabs_02&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;h2&gt;Representation&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;p&gt;CSS&lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;/dd&gt;<br>
<br>
&nbsp;&nbsp;&nbsp;  &lt;dt id=&quot;tab_03&quot;&gt;行为&lt;/dt&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;dd id=&quot;tabs_03&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;h2&gt;Behavior&lt;/h2&gt;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &lt;p&gt;DOM、ECMAScript&lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;  &lt;/dd&gt;<br>
&lt;/dl&gt;<br>
<br>
&lt;script type=&quot;text/<strong>javascript</strong>&quot;&gt;<br>
&lt;!--<br>
&nbsp;&nbsp;&nbsp;  timertab(&quot;tab_01&quot;,2);<br>
//--&gt;<br>
&lt;/script&gt;<br>
<br>
&lt;style type=&quot;text/<strong>css</strong>&quot; media=&quot;screen&quot;&gt;<br>
&lt;!--<br>
body,dl,dt,dd{font:12px/1.5em arial;padding:0;margin:0;color:#666;}<br>
body{margin:25px;}<br>
a:link{color:#369;text-decoration: none; }<br>
a:hover{color:#c83;}<br>
.tab{width:210px;border:1px solid #ccc;height: 140px;position: relative; }<br>
.tab dt{float:left;width:70px;padding:3px 0 2px;background: #eee;text-align: center;color:#666;cursor:pointer;}<br>
.tab dt.on{background: #fff;color:#c83;}<br>
.tab dd{display:none;position: absolute;left:0;top:25px;padding:10px;}<br>
.tab dd.on{display:block;}<br>
.tab dd h2{margin:7px 3px 0;font:bold 1.2em arial;color:#999;}<br>
.tab dd p{margin:3px;text-indent: 2em;}<br>
--&gt;<br>
&lt;/style&gt;<br>
<strong><br>
function </strong><strong>timertab(t,a){ //</strong><strong>t为要应用此函数的tab的id</strong><strong>，a初始化时显示的项目的顺序数</strong><br>
&nbsp;&nbsp;&nbsp;  this.obj = document.getElementById(t).getElementsByTagName(&quot;dt&quot;);//导航<br>
&nbsp;&nbsp;&nbsp;  this.eles = document.getElementById(t).getElementsByTagName(&quot;dd&quot;);//内容<br>
&nbsp;&nbsp;&nbsp;  this.<strong>start </strong>= a-1;//初始项目<br>
&nbsp;&nbsp;&nbsp;  this.<strong>speed </strong>= 2000;//切换间隔<br>
&nbsp;&nbsp;&nbsp;  this.<strong>setid </strong>= null;//定时器<br>
<br>
&nbsp;&nbsp;&nbsp;  var <strong>loop </strong>= function(){ //自动切换<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  for(var i=0,j=obj.length;i&lt;j;i++){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  obj[i].className = &quot;&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  eles[i].className = &quot;&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  obj[start].className = &quot;on&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  eles[start].className = &quot;on&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  setid=<strong>setTimeout</strong>(<strong>loop</strong>,speed);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  <strong>start++</strong>;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  if(start==obj.length){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  start=0;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  //clearTimeout(setid);//<strong>只循环一次</strong><br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  };loop();<br>
<br>
&nbsp;&nbsp;&nbsp;  var <strong>clik </strong>= function(){ //点击<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  for(var i=0;i&lt;obj.length;i++){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  obj[i].onclick = function(){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  <strong>clearTimeout</strong>(setid);//停止原来的自动切换<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  var inb = this.id.substr(this.id.indexOf(&quot;#&quot;)+6,1);//这里的数字6为dt的id中数字序号出现的位置数<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  for(var i=0,j=obj.length;i&lt;j;i++){//重新初始化<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  obj[i].className = &quot;&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  eles[i].className = &quot;&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  this.className = &quot;on&quot;;//显示点击项<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  eles[inb-1].className = &quot;on&quot;;<br>
<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  start=inb-1;//<strong>从这里开始继续循环（可以根据要求选择是否去掉这部分）</strong><br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  <strong>loop</strong>(); <br>
<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  return false //取消&lt;a href=&quot;#tabs_01&quot;&gt;默认事件<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }<br>
&nbsp;&nbsp;&nbsp;  };clik();<br>
} 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/fce701f78eeaff26730eece5.html#comment">查看评论</a>]]></description>
        <pubDate>2008-02-01  12:30</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/fce701f78eeaff26730eece5.html</guid>
</item>

<item>
        <title><![CDATA[CSS框架、(X)HTML标签默认样式]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/3ff1eddd63c1ddeb77c638fd.html]]></link>
        <description><![CDATA[
		
		最近看到很多谈论CSS框架（CSS Framework）的文章，大概的思路如下：<br>
&nbsp;&nbsp;&nbsp;    1. 先清除(X)HTML标签的默认样式<br>
&nbsp;&nbsp;&nbsp;    2. 设置属于你自己的(X)HTML标签样式和你常用的Class或者Id样式<br>
<br>
当然，框架最基本的用途就是减少重复劳动，能节省你的时间，一个项目不用从一无所有开始...... 可以使用你自己总结和收集的CSS和(X)HTML代码模块，前提是先拥有框架(CSS和[或]XHTML)。<br>
<br>
同时想到以前总结过一些文字<a href="http://hi.baidu.com/webworker/blog/item/a31cb43eefa5abfa838b1331.html" target="_blank">(X)HTML 标签默认的样式属性值</a>，这两者是不是做了部分同样的工作呢？浏览器一开始设置默认样式，然后你再重新设置成你的默认样式，同时设置你常用的标签样式，这样(X)HTML在样式显示方面做的就是做无用功了。<br>
<br>
这样问题就转到(X)HTML标签和他的默认样式来了，一些常用的页面模块如header、nav、aside、section预计在HTML5中会出现专用标签，这能减少在CSS中自定义常用模块，而标签的默认样式问题，却很少有更新，不知道是为了兼顾各种不同的用户需求，还是别的什么。。。<br>
<br>
Referrence:<a href="http://www.smashingmagazine.com/2007/09/21/css-frameworks-css-reset-design-from-scratch/" target="_blank">CSS Frameworks + CSS Reset: Design From Scratch</a><br>
http://www.smashingmagazine.com/2007/09/21/css-frameworks-css-reset-design-from-scratch/ 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Css">Css</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/3ff1eddd63c1ddeb77c638fd.html#comment">查看评论</a>]]></description>
        <pubDate>2008-01-21  14:12</pubDate>
        <category><![CDATA[Css]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/3ff1eddd63c1ddeb77c638fd.html</guid>
</item>

<item>
        <title><![CDATA[一个拖拽的基本函数 basic drag function with Cookie]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/48175f2c222094e88b1399ac.html]]></link>
        <description><![CDATA[
		
		<strong>更新（2008-04-09）：</strong>以前的版本中存在拖动模块中的内容不可选的问题，原因为函数FocusIt和MoveIt中判断事件对象不是目标对象后用了return false。<br>
<br>
拖拽的实现其实挺简单的，这里的简单是实现原理的简单，利用鼠标事件：<strong>mousedown</strong>锁定目标，<strong>mousemove</strong>移动，<strong>mouseup</strong>退出移动，设置<strong>全局变量</strong>为开关。（可以设置Cookie存取上一次的位置坐标）<br>
<br>
判断是否存在可用的<strong>Cookie</strong>，如有，读取上一次的数据并定位。<br>
<br>
<strong>锁定目标对象是关键，</strong>判断点击部位是否是可以拖拽的部位，如果是设置移动对象的position，及其left和top（也就是相对于网页的坐标，offsetLeft和offsetTop），打开可以移动的开关。<br>
<br>
<strong>移动对象，</strong>让移动对象相对于屏幕原点的坐标系，随着鼠标位置的变化而移动（clientX 和clientY ）。<br>
<br>
<strong>退出移动，</strong>关闭可以移动的开关，存储坐标位置的Cookie。<br>
<strong><br>
JavaScript</strong><br>
&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;<br>
&lt;!--<br>
<br>
window.onload = function(){<br>
&nbsp;&nbsp;&nbsp;              <strong>drag(&quot;box&quot;,&quot;t&quot;);</strong><br>
}<br>
<br>
<strong> function drag(el,bar)</strong>{//el为要移动的对象的id，bar为可拖拽部位的class<br>
<br>
&nbsp;&nbsp;&nbsp;              var box=document.getElementById(el); //获得拖拽对象<br>
&nbsp;&nbsp;&nbsp;              var t=bar;//定义className为t的部位才可拖拽<br>
&nbsp;&nbsp;&nbsp;              var ie=!!(window.attachEvent &amp;&amp; !window.opera);//判断是否IE<br>
&nbsp;&nbsp;&nbsp;              var par=false; // 拖拽对象是否可以移动的开关<br>
&nbsp;&nbsp;&nbsp;              var elx, ely; // 拖拽对象在页面上的坐标<br>
&nbsp;&nbsp;&nbsp;              var x,y; // 拖拽对象在屏幕上的坐标<br>
<br>
//页面载入时 ，如果有Cookie 读取 并设置初始位置<br>
&nbsp;&nbsp;&nbsp;        var cleft = GetCookie(&quot;cleft&quot;);<br>
&nbsp;&nbsp;&nbsp;        var ctop = GetCookie(&quot;ctop&quot;);<br>
&nbsp;&nbsp;&nbsp;        if(cleft&amp;&amp;ctop){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        box.style.position = &quot;absolute&quot;;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        box.style.left = cleft;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        box.style.top = ctop;<br>
&nbsp;&nbsp;&nbsp;        }<br>
<br>
&nbsp;&nbsp;&nbsp;              box.onmousedown = FocusIt; //拖拽前预处理<br>
&nbsp;&nbsp;&nbsp;              document.onmousemove = MoveIt; //拖拽<br>
&nbsp;&nbsp;&nbsp;              document.onmouseup = ClearIt; //清除拖拽<br>
<br>
&nbsp;&nbsp;&nbsp;  function FocusIt(e){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  var target = ie ? event.srcElement : e.target;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  if(target.className==t){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  par = true;//打开开关<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  box.style.position = &quot;absolute&quot;;//让对象绝对定位，可以在屏幕上任意位置出现<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  box.style.left = box.offsetLeft+&quot;px&quot;;//获得拖拽对象的当前页面坐标（最后加的px为了兼容ff）<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  box.style.top = box.offsetTop+&quot;px&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  x= ie ? event.clientX : e.clientX;//获得鼠标的当前页面坐标<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  y= ie ? event.clientY : e.clientY;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  elx = parseInt(box.style.left);//获得拖拽对象的当前页面坐标，并转换为数字，用于后面的计算<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  ely = parseInt(box.style.top);<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  }&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  }<br>
<br>
&nbsp;&nbsp;&nbsp;  function MoveIt(e){<br>
&nbsp;&nbsp;&nbsp;    if (par){<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  box.style.left = ie ? event.clientX + (elx - x) + &quot;px&quot; : e.clientX + (elx - x) + &quot;px&quot;;<br>
&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  box.style.top  = ie ? event.clientY + (ely - y) + &quot;px&quot; : e.clientY + (ely - y) + &quot;px&quot;;//让拖拽对象在页面的坐标相对于鼠标的坐标移动<br>
&nbsp;&nbsp;&nbsp;    }<br>
&nbsp;&nbsp;&nbsp;  }<br>
<br>
&nbsp;&nbsp;&nbsp;              function ClearIt(){&nbsp;&nbsp;&nbsp;              <br>
&nbsp;&nbsp;&nbsp;              &nbsp;&nbsp;&nbsp;              par = false;//关闭开关<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        SetCookie(&quot;cleft&quot;,box.style.left);//保存当前位置<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        SetCookie(&quot;ctop&quot;,box.style.top);<br>
&nbsp;&nbsp;&nbsp;              } <br>
<br>
//Cookie <br>
&nbsp;&nbsp;&nbsp;           function SetCookie(sName, sValue){<br>
&nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           document.cookie = sName + &quot;=&quot; + escape(sValue) + &quot;; &quot;;<br>
&nbsp;&nbsp;&nbsp;           }<br>
&nbsp;&nbsp;&nbsp;           function GetCookie(sName){<br>
&nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           var aCookie = document.cookie.split(&quot;; &quot;);<br>
&nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           for (var i=0; i &lt; aCookie.length; i++){<br>
&nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           var aCrumb = aCookie[i].split(&quot;=&quot;);<br>
&nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           if (sName == aCrumb[0]) <br>
&nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           return unescape(aCrumb[1]);<br>
&nbsp;&nbsp;&nbsp;           &nbsp;&nbsp;&nbsp;           }<br>
&nbsp;&nbsp;&nbsp;           }<br>
}<br>
//--&gt;<br>
&lt;/script&gt;<br>
<br>
<strong>CSS<br>
</strong>&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;<br>
&lt;!--<br>
#box{width: 250px;height:200px;border:1px solid #ccc;background: #fff;}<br>
#box .t{height:20px;margin:0;padding:2px 4px;border-bottom:1px dashed #ddd;background: #f8f8f8;cursor: move;font:12px;color:#f83;}<br>
#box .t:hover{background: #eee;border-bottom:1px dashed #fc0;}<br>
--&gt;<br>
&lt;/style&gt;<br>
<br>
<strong>Html</strong><br>
&lt;div id=&quot;box&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;              &lt;h3 class=&quot;t&quot;&gt;title and drag Bar&lt;/h3&gt;<br>
&nbsp;&nbsp;&nbsp;              &lt;div class=&quot;ct&quot;&gt;content&lt;/div&gt;<br>
&lt;/div&gt; 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/48175f2c222094e88b1399ac.html#comment">查看评论</a>]]></description>
        <pubDate>2008-01-14  12:38</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/48175f2c222094e88b1399ac.html</guid>
</item>

<item>
        <title><![CDATA[Javascript 内存泄漏问题]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/25f9f0dcf14d51a2cc116671.html]]></link>
        <description><![CDATA[
		
		<strong>内存泄漏</strong>，就是内存不能够被正确地配置，内存不能及时有效回收，他会导致程序执行效率降低甚至执行失败。<br>
<br>
在浏览器领域，大部分都可能会出现内存泄漏问题，但是以IE最为多见，也最为严重，尤其是页面中有<strong>许多Javascript的交互</strong>效果的时候。其中涉及到<strong>循环结构（cyclic structure）</strong>、<strong>DOM</strong>对象属性、<strong>JavaScript</strong>对象属性以及<strong>垃圾回收器</strong><strong>（</strong><strong>garbage collector</strong><strong>）</strong>。<br>
<br>
<strong>循环结构（cyclic structure）</strong>，是指一个DOM对象包含<strong>JavaScript对象参数（事件处理函数）</strong>，JavaScript对象又包含了<strong>DOM对象的属性参数</strong>。（比如给某个超链接A添加一个onclick事件函数，这时候A就有了相应的事件处理函数，而JavaScript函数对象中也有了A的onclick属性）。<br>
<br>
当循环结构（cyclic structure）形成时如果<strong>没有别的参数传递</strong>给DOM对象或者Javascript函数对象，JavaScript的<strong>垃圾回收器</strong>（一个自动内存管理器）就会把这两个对象的内存释放并重新进行配置，但是IE的DOM对象属性参数并不能由JavaScript管理清除（不能清除DOM对象的属性参数），而他自己的内存管理机制并不能理解循环结构（cyclic structure）的垃圾回收机制。因此，当循环结构（cyclic structure）的垃圾回收条件形成时，IE也不能进行正确的内存回收管理，导致内存泄漏。当然，<strong>这只有在循环结构</strong><strong>的未回收内存</strong><strong>的数量达到很大的数量级的时候，才会出现明显的内存泄漏症状。</strong><br>
<br>
此外，由于循环结构在<strong>闭包</strong>中出现的几率较大，内存泄漏问题也是不可忽视的。<br>
<br>
<strong>解决的办法有：</strong><br>
<br>
<strong>一、避免让可能被移除或改变的</strong><strong>DOM对象（remove node/reset innerHTML）中出现</strong><strong>循环结构（cyclic structure）；<br>
<br>
</strong><strong>二、在DOM对象被移除前（remove node/reset innerHTML）清空他的属性参数（domNode.Jsfunction = null）<br>
<br>
</strong>  1.避免扩展DOM对象的属性参数，如果有要在适当的时候清空；<br>
2.如果某个事件处理函数在移除后可能被某些DOM对象调用，一定要清空；<br>
3.Ajax中XMLHttpRequest的onreadystatechange事件函数调用之后要清。<br>
4....<br>
<br>
<br>
<strong><font size="3">以上纯属个人理解，大家自行辨解，同时还望各位高手不吝赐教。<br>
<br>
</font></strong> <br>
<strong>附</strong>一个可以清除某个DOM对象及其子孙对象的事件属性的函数<br>
function purge(d) {<br>
&nbsp;&nbsp;&nbsp;      var a = d.attributes;//取得DOM对象的所有事件属性<br>
&nbsp;&nbsp;&nbsp;      if (a) {<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      var l = a.length;<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      for ( var i = 0; i &lt; l; i += 1) {<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      var n = a[i].name;//取得DOM对象事件属性的名称如onclick、onblur等<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      if (typeof d[n] === 'function') {<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      d[n] = null;//清空DOM对象事件属性的值<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      }<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      }<br>
&nbsp;&nbsp;&nbsp;      }<br>
&nbsp;&nbsp;&nbsp;      a = d.childNodes;//处理子元素<br>
&nbsp;&nbsp;&nbsp;      if (a) {<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      l = a.length;<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      for (i = 0; i &lt; l; i += 1) {<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      purge(d.childNodes[i]);<br>
&nbsp;&nbsp;&nbsp;      &nbsp;&nbsp;&nbsp;      }<br>
}<br>
}<br>
<br>
<br>
Douglas Crockford: <a href="http://www.crockford.com/ /memory/leak.html" target="_blank">JScript Memory Leaks</a><br>
http://www.crockford.com/javascript/memory/leak.html<br>
<br>
Justin Rogers: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/IETechCol/dnwebgen/ie_leak_patterns.asp" target="_blank">Understanding and Solving Internet Explorer Leak     Patterns</a><br>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/IETechCol/dnwebgen/ie_leak_patterns.asp 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/25f9f0dcf14d51a2cc116671.html#comment">查看评论</a>]]></description>
        <pubDate>2007-12-11  18:38</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/25f9f0dcf14d51a2cc116671.html</guid>
</item>

<item>
        <title><![CDATA[事件侦听参数e的应用以及事件冒泡]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/633ddf2ab32fe02ed52af15b.html]]></link>
        <description><![CDATA[
		
		给某些区域的元素或批量的元素添加事件，一般情况下我们通过循环来实现：先找到所有对应的元素，再给它们添加相应的事件。<br>
<br>
如果学习一些W3C事件处理模式的知识，可以找到另一种实现的方法:利用事件侦听参数e。<br>
<br>
在<strong>W3C事件处理模式</strong>中：所有通过addEvent给节点元素添加的事件处理器都会<strong>给对应的事件侦听函数传回一个包含e参数的对象</strong>，在浏览器中我们可以利用e.target（标准）e.srcElement（IE）来<strong>取得事件的目标元素</strong>。<br>
一旦此元素的事件处理器被激活，<strong>此元素的父元素的所有事件处理器也会被激活，即冒泡</strong>，可以通过stopPropagation或cancelBubble来取消冒泡。<br>
<br>
下面是利用此原理对FAQ实例重新写的代码。<br>
<br>
<strong>Javascript部分：</strong><br>
&lt;script type=&quot;text/javascript&quot;&gt;<br>
&lt;!--<br>
window.onload = function(){<br>
&nbsp;&nbsp;&nbsp;     var obj = document.getElementById(&quot;faq&quot;);<br>
&nbsp;&nbsp;&nbsp;     if (!obj) return false;<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     obj.onclick = function(e){//<strong>传递事件侦听参数e</strong><br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     var e = e || window.event;//<strong>取得事件侦听参数e</strong><br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     var tg = e.target || e.srcElement; //<strong>取得事件</strong><strong>的目标元素</strong><br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     if(tg.tagName==&quot;H3&quot;){//取得目标对象：标题<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     tg.className = tg.className == &quot;&quot;?&quot;on&quot;:&quot;&quot;;//设置标题样式<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     var tp = tg.parentNode.lastChild;//取得这个标题相对应的正文内容（此语句存有<strong>bug</strong>：在ff2中html的父标签li与子标签h3,p之间有空格或回行时）<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     tp.style.display = tp.style.display == &quot;none&quot;?&quot;block&quot;:&quot;none&quot;;//显示或隐藏正文<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     }<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     if (window.event){//判断是否IE<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     window.event.cancelBubble = true;//<strong>IE 取消冒泡（点击超链接时不触其父元素的事件）</strong><br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     //window.event.returnValue = false;//IE 取消默认行为<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     }<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     else{<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     e.stopPropagation();//<strong>取消冒泡</strong><br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     //e.preventDefault();//取消默认行为<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     }<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     }<br>
}<br>
//--&gt;<br>
&lt;/script&gt;<br>
<br>
Html部分：<br>
&lt;ul id=&quot;faq&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;     &lt;li&gt;&lt;h3&gt;headline&lt;a href=&quot;http://www.baidu.com&quot; target=&quot;_blank&quot;&gt;search&lt;/a&gt;&lt;/h3&gt;<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &lt;p&gt;paragraph paragraph paragraph&lt;/p&gt;&lt;/li&gt;<br>
&nbsp;&nbsp;&nbsp;     &lt;li&gt;&lt;h3&gt;headline&lt;/h3&gt;<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &lt;p&gt;paragraph paragraph paragraph&lt;/p&gt;&lt;/li&gt;<br>
&nbsp;&nbsp;&nbsp;     &lt;li&gt;&lt;h3&gt;headline&lt;/h3&gt;<br>
&nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp;     &lt;p&gt;paragraph paragraph paragraph&lt;/p&gt;&lt;/li&gt;<br>
&lt;/ul&gt;<br>
<br>
Css部分：<br>
&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;<br>
&lt;!--<br>
#faq{list-style:none;margin:0;padding:0;}<br>
#faq h3{background:#ccc;margin:10px 0 0;padding:3px;font:14px/1.5em arial;border-top:2px solid #369;}<br>
#faq h3.on{background:#ddd;}<br>
#faq h3 a{float: right;margin:-1.8em 1em 0 0;}<br>
#faq p{margin:0;padding:4px;font:12px/1.5em arial;background: #efefef;border-bottom:1px solid #369;}<br>
--&gt;<br>
&lt;/style&gt;<br>
<br>
<a target="_blank" href="http://icant.co.uk/articles/from-dhtml-to-dom/from-dhtml-to-dom-scripting.html#domtabs">From DHTML to DOM scripting</a>  -- Christian Heilmann<br>
http://icant.co.uk/articles/from-dhtml-to-dom/from-dhtml-to-dom-scripting.html#domtabs 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/633ddf2ab32fe02ed52af15b.html#comment">查看评论</a>]]></description>
        <pubDate>2007-11-26  17:18</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/633ddf2ab32fe02ed52af15b.html</guid>
</item>

<item>
        <title><![CDATA[搜索引擎优化 SEO？]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/b0156ad91f80d62f10df9b78.html]]></link>
        <description><![CDATA[
		
		个人认为纯粹的为SEO而SEO没有必要，但是其中有一些涉及网站/页面的结构和制作，并且有一定的指导作用。在一个外国seo公司的网站上看到的一个测试，但是题目比较多（75道），对下列问题有兴趣的朋友可有去<a target="_blank" href="http://www.seomoz.org/seo-expert-quiz/take">做一下</a>（做完后有正确的答案和分析）。<br>
<br>
&nbsp;&nbsp;&nbsp;   在什么区域设置的关键词是最不重要的？<br>
&nbsp;&nbsp;&nbsp;    如何对待页面的title？<br>
&nbsp;&nbsp;&nbsp;    域名和URL结构重要吗？<br>
&nbsp;&nbsp;&nbsp;    怎么处理你的链接？<br>
&nbsp;&nbsp;&nbsp;    什么因素影响搜索引擎收录你的网站和页面和排名？<br>
&nbsp;&nbsp;&nbsp;    如何不被搜索引擎收录？<br>
&nbsp;&nbsp;&nbsp;    遵循W3C是否还有必要？<br>
&nbsp;&nbsp;&nbsp;    站点地图可以忽略吗？<br>
<br>
<a target="_blank" href="http://www.seomoz.org/seo-expert-quiz/take">Seo expert quiz</a> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/%D7%DB%BA%CF">综合</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/b0156ad91f80d62f10df9b78.html#comment">查看评论</a>]]></description>
        <pubDate>2007-10-29  10:49</pubDate>
        <category><![CDATA[综合]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/b0156ad91f80d62f10df9b78.html</guid>
</item>

<item>
        <title><![CDATA[说说jQuery]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/3046b101bf5ca100728da5f1.html]]></link>
        <description><![CDATA[
		
		<a target="_blank" href="http://jquery.com/">jQuery</a>是最近比较火的一个JavaScript库，从<a target="_blank" href="http://del.icio.us/search/?fr=del_icio_us&amp;p=jquery&amp;type=all">del.icio.us/</a>上相关的收藏可见一斑。<br>
<br>
到目前为之jQuery已经发布到1.2.1版本，而在这之前的一个星期他们刚发布1.2版本，看看他的各个版本的<a target="_blank" href="http://code.google.com/p/jqueryjs/downloads/list">发布时间</a>，不难发现他的飞速发展，每个月都在更新版本；而且不断有人开发出新的<a target="_blank" href="http://jquery.com/plugins/">jQuery插件</a>，最近又推出了<a target="_blank" href="http://ui.jquery.com/">jQuery UI</a>库。<br>
<br>
<br>
jQuery于2006年一月十四号在BarCamp NYC (New York City)面世。主将<a target="_blank" href="http://ejohn.org/">John Resig</a>，写有<a target="_blank" href="http://jspro.org/">《Pro JavaScript Techniques》</a>一书，因为效力于mozolla，据说firefox 3将包含Jquery，现在的<a target="_blank" href="http://docs.jquery.com/About/Contributors">Jquery团队</a>有主要开发人员，推广人员，UI，插件开发，网站设计维护，其中3个主要开发人员分别是：两个美国人John Resig/Brandon Aaron，一个德国人Jorn Zaefferer)<br>
<br>
<br>
<font size="3"><strong> 下面简单介绍一下jQuery的一些<a target="_blank" href="http://docs.jquery.com/Main_Page">特性和用法</a>：</strong></font><br>
<br>
<strong>1.精准简单的选择对象(dom)：<br>
<br>
$('#element');</strong>// 相当于document.getElementById(&quot;element&quot;)<br>
<br>
$('.element');//Class<br>
$('p');//html标签<br>
$(&quot;form &gt; input&quot;);//子对象<br>
$(&quot;div,span,p.myClass&quot;);//同时选择多种对象<br>
$(&quot;tr:odd&quot;).css(&quot;background-color&quot;, &quot;#bbbbff&quot;);//<strong>表格的隔行背景</strong><br>
$(&quot;:input&quot;);//表单对象<br>
$(&quot;input[name='newsletter']&quot;);//特定的表单对象<br>
<br>
<strong>2.对象函数的</strong><strong>应用简单和</strong><strong>不限制：<br>
<br>
element.function(par)；<br>
<br>
</strong> $(&rdquo;p.surprise&rdquo;).addClass(&rdquo;ohmy&rdquo;).show(&rdquo;slow&rdquo;)...<br>
<br>
<strong>3.对已选择对象的操作（包括样式）：</strong><br>
$(&quot;#element&quot;).addClass(&quot;selected&quot;);//给对象添加样式<br>
$('#element').css({ &quot;background-color&quot;:&quot;yellow&quot;, &quot;font-weight&quot;:&quot;bolder&quot; });//改变对象样式<br>
$(&quot;p&quot;).text(&quot;Some new text.&quot;);//改变对象文本<br>
$(&quot;img&quot;).attr({ src: &quot;test.jpg&quot;, alt: &quot;Test Image&quot; });//改变对象文本<br>
$(&quot;p&quot;).add(&quot;span&quot;);//给对象增加标签<br>
$(&quot;p&quot;).find(&quot;span&quot;);//查找对象内部的对应元素<br>
$(&quot;p&quot;).parent();//对象的父级元素<br>
$(&quot;p&quot;).append(&quot;&lt;b&gt;Hello&lt;/b&gt;&quot;);//给对象添加内容<br>
<br>
<strong>4.支持aJax，支持文件格式：xml/html/script/json/jsonp</strong><br>
$(&quot;#feeds&quot;).load(&quot;feeds.html&quot;);//相应区域导入静态页内容<br>
$(&quot;#feeds&quot;).load(&quot;feeds.php&quot;, {limit: 25}, function(){alert(&quot;The last 25 entries in the feed have been loaded&quot;);});//导入动态内容<br>
<br>
<strong>4.对事件的支持：</strong><br>
$(&quot;p&quot;).hover(function () {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       $(this).addClass(&quot;hilite&quot;);//鼠标放上去时<br>
&nbsp;&nbsp;&nbsp;       }, function () {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       $(this).removeClass(&quot;hilite&quot;);//移开鼠标<br>
&nbsp;&nbsp;&nbsp;       });//鼠标放上去和移开的不同效果（<strong>自动循环所有p对象</strong>）<br>
<br>
<strong>5.动画：</strong><br>
$(&quot;p&quot;).show(&quot;slow&quot;);//隐藏对象(慢速渐变)<br>
$(&quot;#go&quot;).click(function(){<br>
$(&quot;#block&quot;).animate({ <br>
&nbsp;&nbsp;&nbsp;       width: &quot;90%&quot;,<br>
&nbsp;&nbsp;&nbsp;       height: &quot;100%&quot;, <br>
&nbsp;&nbsp;&nbsp;       fontSize: &quot;10em&quot;<br>
}, 1000 );<br>
});//鼠标点击后宽、高、字体的动态变化<br>
<br>
<strong>6.扩展：</strong><br>
$.fn.background = function(bg){<br>
&nbsp;&nbsp;&nbsp;       return this.css('background', bg);<br>
};<br>
$(#element).background(&quot;red&quot;);<br>
如果要为每一个jQuery 对象添加一个函数，必须把该函数指派给 $.fn，同时这个函数必须要返回一个 this（jQuery 对象）<br>
<br>
<br>
<strong>jQuery相关</strong><br>
----------------------------------------<br>
1.<a target="_blank" href="http://www.packtpub.com/jQuery/book/mid/100407j4kh3d">《Learning jQuery:Better Interaction Design and Web Development with Simple JavaScript Techniques》</a>第一本由jQuery的开发人员写的关于如何学习jQuery的书已经于七月面世，同时还有三本相关的书在问世当中。<br>
2.<a target="_blank" href="http://docs.jquery.com/JQueryCamp07">jQueryCamp 2007</a>，一个jQuery开发人员的见面会也将于10月27日在Boston召开。<br>
3.<a target="_blank" href="http://www.visualjquery.com/1.1.2.html">VisualJquery</a>是一个Jquery的学习和查询网站，也跟着更新到了1.1.2版本。<br>
<br>
<br>
<br>
<a target="_blank" href="http://jquery.com/"><strong>jQuery官网介绍翻译：</strong></a><br>
----------------------------------------<br>
jQuery是一个以前未曾有过的JavaScript库。<br>
<br>
他快速、简洁，能够很轻易地处理HTML文档、控制事件、给页面添加动画和Ajax效果。<br>
jQuery是为了改变JavaScript的编写方式而设计的。<br>
<br>
他适合所有人：设计师、开发人员、极客、商业应用...<br>
<br>
体积小：26.5KB（1.2.1压缩版），45.3KB（1.2.1精简版），78.6KB（1.2.1完整版）...<br>
&nbsp;&nbsp;&nbsp;       &nbsp;&nbsp;        &nbsp;&nbsp;       20.7KB（1.1.2压缩版），57.9KB（1.1.2完整版）<br>
兼容性：支持CSS 1-3和基本的XPath<br>
跨浏览器：IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+（向后兼容）<br>
<br>
<a target="_blank" href="http://jquery.com/plugins/"><strong>jQuery插件</strong></a><br>
----------------------------------------<br>
Ajax (25)/Animation and Effects (26)/Browser Tweaks (6)/Data (17)/DOM (21)/Drag-and-Drop (6)/Events (19)/Forms (39)/Integration (12)/JavaScript (20)/jQuery Extensions (37)/Layout (23)/Media (13)/Menus (13)/Navigation (23)/Tables (11)/User Interface (84)/Utilities (27)/Widgets (41)/Windows and Overlays (4)<br>
<br>
<a target="_blank" href="http://ui.jquery.com/"><strong>jQueryUI库</strong></a><br>
----------------------------------------<br>
基本的鼠标互动：拖拽(drag and dropping)、排序(sorting)、选择(selecting)、缩放(resizing)<br>
各种互动效果：手风琴式的折叠菜单(accordions)、日历(date pickers)、对话框(dialogs)、滑动条(sliders)、表格排序(table sorters)、页签(tabs)、放大镜效果(magnifier)、阴影效果(shadow)<strong><br>
</strong> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/3046b101bf5ca100728da5f1.html#comment">查看评论</a>]]></description>
        <pubDate>2007-10-11  17:47</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/3046b101bf5ca100728da5f1.html</guid>
</item>

<item>
        <title><![CDATA[结构、表现、行为三层分离：FAQ展开隐藏效果]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/c61d851080947b03203f2e20.html]]></link>
        <description><![CDATA[
		
		FAQ是网络上经常出现的一种形式，当回答的内容很多的时候，页面会显得比较冗长，现在很多网站都先把回答的内容隐藏起来，鼠标点击的时候展开，这样节省了空间，又能够让用户快速找到自己想要的信息，而且没有打开新页面那样的延时。<br>
<br>
在下面的例子中，Js只是为了增加更好的互动效果，<strong>不影响页面信息的正常展示</strong>。在没有Js的情况下，所有回答内容都是展开的，一经调用js，ps[i].style.display = &quot;none&quot;;所有回答内容立即隐藏，当鼠标点击某个问题时再显示相关的回答。<br>
<br>
代码中关键是参数的传递，利用<strong>h3s[i].num = i</strong>;给主函数创建一个传参属性， 在子函数中，利用<strong>h3s[<strong>this.</strong><strong>num</strong>];</strong>来同步参数<strong>。<br>
<br>
</strong> 关于onclick触发事件，因为是在 window.onload函数中，所以<strong>onclick触发的事件一定要是一个函数的形式</strong>，否则onload完毕就会自动执行onclick事件。<br>
<br>
此外，<strong>? : </strong>的利用在某些情况下可以减少不少代码的书写。<strong><br>
<br>
<strong>Javascript</strong><br>
</strong> window.onload = function(){<br>
&nbsp;&nbsp;&nbsp;        var obj  = document.getElementById(&quot;faq&quot;);<br>
&nbsp;&nbsp;&nbsp;        if (!obj) return false;<br>
&nbsp;&nbsp;&nbsp;        var h3s  = obj.getElementsByTagName(&quot;h3&quot;);<br>
&nbsp;&nbsp;&nbsp;        var ps  = obj.getElementsByTagName(&quot;p&quot;);<br>
&nbsp;&nbsp;&nbsp;        for (var i=0;i&lt;h3s.length;i++)<br>
&nbsp;&nbsp;&nbsp;        {<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        ps[i].style.display = &quot;none&quot;;<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        h3s[i].onclick = <br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        function detail(){<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        ps[this.num].style.display = ps[this.num].style.display == &quot;block&quot;?&quot;none&quot;:&quot;block&quot;;<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        h3s[this.num].className = h3s[this.num].className == &quot;on&quot;?&quot;&quot;:&quot;on&quot;;<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        };<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;        h3s[i].num = i;<br>
&nbsp;&nbsp;&nbsp;        }<br>
}<br>
<br>
<strong> <strong>HTML<br>
</strong></strong>&lt;div id=&quot;faq&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;          &lt;h3&gt;headline&lt;/h3&gt;<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        &lt;p&gt;paragraph paragraph paragraph&lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;          &lt;h3&gt;headline&lt;/h3&gt;<br>
&nbsp;&nbsp;&nbsp;          &nbsp;&nbsp;&nbsp;        &lt;p&gt;paragraph paragraph paragraph&lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;          &lt;h3&gt;headline&lt;/h3&gt;<br>
&nbsp;&nbsp;&nbsp;        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        &lt;p&gt;paragraph paragraph paragraph&lt;/p&gt;<br>
&lt;/div&gt;<br>
<br>
<strong>CSS<br>
</strong>#faq h3{background:#eee;margin:0;padding:3px;}<br>
#faq h3.on{background:#ccc;}<br>
#faq p{margin:10px 0;text-indet:2em;} 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/c61d851080947b03203f2e20.html#comment">查看评论</a>]]></description>
        <pubDate>2007-07-05  17:38</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/c61d851080947b03203f2e20.html</guid>
</item>

<item>
        <title><![CDATA[input的水平对齐和table的caption]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/2a969022033f1af1d7cae29c.html]]></link>
        <description><![CDATA[
		
		<strong>1.表单项不能水平对齐的问题<br>
<br>
</strong>input中类型分别为text和submit的表单项目放在同一行时，会出现<strong>表单项不能水平对齐</strong>的问题，尤其是指定了他们的<strong>高度和边框</strong>之后，而且ie和ff效果差异很大。这是在XHTML 1.0 Transitional的文档申明下，不用表格来布局，会出现这样的情况。 <br>
<br>
position可以解决这个问题，但是并不理想，用<strong>input {vertical-align: middle;}</strong>可以很好地处理这个问题（？）。<br>
<br>
<strong>2.table的caption和th或td之间的缝隙</strong><br>
<br>
当table有caption的时候，在ff下，在<strong>caption或table指定margin</strong>的情况，caption和th或td之间会存在<strong>margin</strong>，即caption和td或th都有背景色，他们之间就会出现<strong>缝隙</strong>。<br>
<br>
W3C的REC-CSS2中table部分提出：table的box是由table和caption两个box合并的，相当于<strong>table和caption</strong>是两个box，这样的话，如果指定他们接触面的margin，就会出现裂缝。<br>
<br>
<strong>W3C:<a target="_blank" href="http://www.w3.org/TR/REC-CSS2/tables.html#q5">Tables in the visual formatting mode</a></strong> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Html">Html</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/2a969022033f1af1d7cae29c.html#comment">查看评论</a>]]></description>
        <pubDate>2007-06-22  18:22</pubDate>
        <category><![CDATA[Html]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/2a969022033f1af1d7cae29c.html</guid>
</item>

<item>
        <title><![CDATA[不同浏览器对JavaScript脚本的识别]]></title>
        <link><![CDATA[http://hi.baidu.com/webworker/blog/item/08d59b132ab4de816438dbf4.html]]></link>
        <description><![CDATA[
		
		CSS在不同浏览器中的解析一直被大家关注，其实JavaScript也存在同样的问题，下面简单列出我知道的几点：<br>
<br>
<strong>document.getElementById</strong>(ID)，document.<strong>getElementsByTagName</strong>(TagName)方法可用于Internet Explorer 5.5+、Mozilla，是 DOM Level 1 规范的一部分；<br>
<strong>document.all</strong>，document.all[ID]，document.all.tags(TagName)方法只适用于Internet Explorer 4.0-； <br>
<strong>document.layers</strong>，document.layers[ID]...方法只适用于Netscape 4.x- 。<br>
<br>
<strong><strong>innerText</strong></strong>只适用于Internet Explorer；<strong><br>
<strong>innerHTML</strong></strong>对于Mozilla和Internet Explorer都适用。<strong><br>
<br>
</strong><strong><strong>window窗口属性</strong><br>
offsetLeft(ff中没有单位)<br>
<br>
</strong><strong>e.target<br>
event.srcElement</strong><br>
<strong> <strong><br>
attachEvent<br>
addEventListener</strong><br>
<br>
<strong>XMLHttpRequest();<br>
ActiveXObject(msxml[i]);</strong><br>
<br>
<br>
参考：<br>
</strong><a href="http://www.ibm.com/developerworks/cn/web/wa-ie2mozgd/?ca=wa-t10" target="_blank">把应用程序从 Internet Explorer 迁移到 Mozilla</a><br>
<a target="_blank" href="http://www.never-online.net/reference/mozillaVsIE/">IE V.S Mozilla (DHTML &amp;&amp; CSS)</a> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/webworker/blog/category/Js">Js</a>&nbsp;<a href="http://hi.baidu.com/webworker/blog/item/08d59b132ab4de816438dbf4.html#comment">查看评论</a>]]></description>
        <pubDate>2007-03-21  17:31</pubDate>
        <category><![CDATA[Js]]></category>
        <author><![CDATA[webworker]]></author>
		<guid>http://hi.baidu.com/webworker/blog/item/08d59b132ab4de816438dbf4.html</guid>
</item>


</channel>
</rss>