[转自:]
项目试用 ,顺手写了一个jQuery的插件
<input type="text" name="paramStart" class="datePicker"/>
调用: jQuery(".datePicker").my97(); 简单试用了一下,满足了基本需求,给需要的人
//my97 datapicker jQuery插件 ;( function ($){ $.fn.my97= function (options){ if (! this .length) { //没有指定页面控件,返回jQuery return this ; } options = $.extend( true , { width: '80px' , title: '选择日期' }, options); this .each( function (){ var $ this = $( this ); if (!$ this .attr( "id" )) { $ this .attr( "id" , "my97dp_" + ($.event.guid++)); } $ this .bind( "click" , function (){ WdatePicker(); }).css({width:options.width}).after( '<img style=\'cursor:pointer;\' title=\'' + options.title + '\' onclick="WdatePicker({el:\'' + $ this .attr("id ") +'\'})" src= "/My97DatePicker/skin/datePicker.gif" width= "16" height= "22" align= "absmiddle" >'); } ); } })(jQuery); |