My97 DatePicker 的jQuery插件

项目试用 my97 datapicker 4.7 ,顺手写了一个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);

posted @ 2011-01-14 12:29  rob_2010  阅读(269)  评论(0)    收藏  举报