手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表2010年07月2日的文章

取消radio的选中状态

一个简单的例子,是懒宝宝让我帮忙的。因为我自己也注意到了,radio在选中后,一般无法取消,查了一下google,发现还是有方法 的。因此,立马解决了:

XML/HTML代码
  1. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>  
  2. <table class="rs" border="0" cellspacing="0" cellpadding="0">  
  3.           <tr>  
  4.             <td>HIV :阴  
  5.               <input type="radio" name="hiv[0]" value="HIV:阴" union="yin"/>  
  6.               阳  
  7.               <input type="radio" name="hiv[0]" value="HIV:阳" union="yang" /></td>  
  8.             <td>梅毒:阴  
  9.               <input type="radio" name="hiv[1]" value="梅毒:阴" union="yin" />  
  10.               阳  
  11.               <input type="radio" name="hiv[1]" value="梅毒:阳" union="yang" /></td>  
  12.             <td>疱疹:阴  
  13.               <input type="radio" name="hiv[2]" value="疱疹:阴" union="yin" />  
  14.               阳  
  15.               <input type="radio" name="hiv[2]" value="疱疹:阳" union="yang" /></td>  
  16.             <td>淋病:阴  
  17.               <input type="radio" name="hiv[3]" value="淋病:阴" union="yin" />  
  18.               阳  
  19.               <input type="radio" name="hiv[3]" value="淋病:阳" union="yang" /></td>  
  20.           </tr>  
  21.           <tr>  
  22.             <td>非淋:阴  
  23.               <input type="radio" name="hiv[4]" value="非淋:阴" union="yin" />  
  24.               阳  
  25.               <input type="radio" name="hiv[4]" value="非淋:阳" union="yang" /></td>  
  26.             <td>湿疣:阴  
  27.               <input type="radio" name="hiv[5]" value="湿疣:阴" union="yin" />  
  28.               阳  
  29.               <input type="radio" name="hiv[5]" value="湿疣:阳" union="yang" /></td>  
  30.             <td>丙肝:阴  
  31.               <input type="radio" name="hiv[6]" value="丙肝:阴" union="yin" />  
  32.               阳  
  33.               <input type="radio" name="hiv[6]" value="丙肝:阳" union="yang" /></td>  
  34.             <td><a style="cursor:pointer;" id='allyin'>全阴</a> <a style="cursor:pointer;" id='allyang'>全阳</a> <a id='allempty' style="cursor:pointer;">重填</a>   
  35. <script>  
  36. $(function(){  
  37.     $('#allyin').click(function(){  
  38.         $(':input[union="yin"]').attr('checked','checked');  
  39.     });  
  40.     $('#allyang').click(function(){  
  41.         $(':input[union=yang]').attr('checked','checked');  
  42.     });  
  43.     $('#allempty').click(function(){  
  44.         $(':input[union=yang]').each(function(){  
  45.             $(this).attr('checked','checked');  
  46.             var tmp = $(this)[0];  
  47.             tmp.checked = false;  
  48.             tmp = null;  
  49.         })  
  50.     });  
  51. });  
  52. </script></td>  
  53.           </tr>  
  54.         </table>  
因为用jquery的话,选中radion的方法很方便。所以,就尝试用这种方式解决了。。。但是用jquery无法取消checked状态,只能用原生js的方式才行(jquery是把元素都转换为对象,而不是DOM对象)

Tags: jquery, radio, checked

XHProf介绍

上次我在博客里提到xhprof是文锋的一次聚会,其中echo就提出了这个xhprof,轻量级,fackbook常用,当然echo他们用的也 很多。

说实话我在之前没有了解过xhprof,大多数情况下还是用xdebug,但在线上的时候,肯定是不敢开这样耗资源的玩意。所以就对xhprof关 心了一点点。再后来看了一点资料,同时echo那天也贴出了部分代码,也基本上是在用概率的方式提取LOG,或者指定某种具体条件的情况下记录,以节省资 源。

今天在闲逛的时候看到有人把中文手册翻译了。感慨万分,好久没有做过这种事情了。不是我太懒,而是真的做不来。

原文在这里:http://www.162cm.com/p/xhprofdoc.html

作者这样介绍自己:

翻译:徐仁禄  <xurenlu [at] gmail.com > 
原文地址: http://mirror.facebook.net/facebook/xhprof/doc.html
初次翻译,大部分是google translate tookit工具给翻的,稍微修改了下。如遇错误,还请来信指出。谢谢!

» 阅读全文

Tags: xhprof, xurenlu

老外翻唱BEyond《海阔天空》

不记得自己是从何时开始喜欢Beyond的了。确实算是一个Beyond迷吧。几乎是每首歌都听过,也几乎每首都会哼。当然限于天赋,大多数是吊不上来的。。。

这首歌翻唱的不错,很有韵味

Tags: beyond, 海阔天空