发布于 2016-08-29 21:54:12 | 105 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的jQuery示例,程序狗速度看过来!

jQuery javascript框架

jQuery是一个兼容多浏览器的javascript框架,核心理念是write less,do more(写得更少,做得更多)。jQuery在2006年1月由美国人John Resig在纽约的barcamp发布,吸引了来自世界各地的众多JavaScript高手加入,由Dave Methvin率领团队进行开发。


扩展对input的一些方法(练习jQuery插件)

/* ================================================================================ 
File:jquery.hy.input.js 
Desc: 扩展对input的一些方法 
Called by: 
Auth: 大气象 
Date: 2009-10-30 
================================================================================ 
Change History 
================================================================================ 
Date: Author: Description: 
-------- -------- ------------------- 
================================================================================ 
Copyright (C) 1992-2009 Hongye Corporation 
================================================================================ 
*/ 
//扩展jQuery对象方法 
jQuery.fn.extend({ 
/*=========================================================================== 
功能描述:单击时清空文本框 
调用方法: 
$(function(){ jQuery("#txt").txtClear();} ); 
*/ 
txtClear:function(){ 
jQuery(this).click(function(){ 
jQuery(this).val(''); 
}); 
}, 
/*=========================================================================== 
功能描述:选择全选 
调用方法: 
情形 
<div id="chkBoxes"> 
<input id="Checkbox1" type="checkbox" /> 
<input id="Checkbox2" type="checkbox" /> 
</div> 
调用 
$("#chkBoxes input[type=checkbox]").check(); 
*/ 
check:function(){ 
return this.each(function(){this.checked=true;}); 
}, 
/*=========================================================================== 
功能描述:取消选择 
调用方法: 
$("#chkBoxes input[type=checkbox]").uncheck(); 
*/ 
uncheck:function(){ 
return this.each(function(){this.checked=false;}); 
} 
});


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务